Tag Info

Hot answers tagged

14

Triangles, the reason is triangles' ratesrization algorithm is faster, and also natively supported in hardware. So it would be faster to convert one quad into two triangles and do the rasterization. Actually that is what happens when you draw a quad on modern graphics hardware. So the question is what makes it faster ? There are certain characteristics in ...


7

No, you don't. All current-generation commodity GPUs use (and have used for some time) triangle-based rasterization methods exclusively. Even though older version of OpenGL support the GL_QUADS rendering mode, these were converted to triangles by commodity GPUs. It's likely that GL_QUADS only resulted in actual quadrilaterial-based rasterization on esoteric ...


6

If you're using a rendering API, then you only need to worry about what that API tells you to worry about. OpenGL doesn't say anything about quad-based or triangle-based rendering systems. So you don't need to concern yourself with it. In any case, all consumer-grade GPUs use triangles, not quads.


5

Create a scale matrix with a scale of -1 on the axis you want to mirror.


5

It’s likely that when loaded by your framework, the texture is padded vertically and horizontally to the nearest power of two. For instance, if it’s a 320×200 image, it will be stored in a 512×256 texture. You have at least two options: use a texture with power of two dimensions or change your texture coordinates to the proper ones, for instance ...


4

Yes, it's typical to convert into triangles. When reading the mesh in, it's simple to convert a quad into a triangle. It will depend on the format you're exporting to. For example, the format I use, Blender will export all the vertices, then it will export index information for triangles and quads. So it's a simple matter of arranging the indices to take a ...


4

If you want to permanently change quads to tris in Blender use Ctrl+T in Edit-Mode


4

I've changed the shader according to the article suggested by Seth Battin. Now it performs perspectively correct quad texturing. Phew, bacon delivered: For the future generations that may never happen. The input is in a form of the line vertexes A1/A2, B1/B2 that creates diagonals (rather then sequential vertexes): public static Vector3 ...


3

Keep in mind that the order you insert your vertices into your array matters too. Additionally, it looks like you're drawing a PrimitiveType.TriangleStrip, not quads. It looks like XNA doesn't have a primitive type for quads. You can index them yourself though, as seen in this tutorial.. If you're using triangles (or quads) to draw lines like your image ...


2

You are not showing all the code but I suggest making width and height floating point values. You are dividing them by 2 at each subdivision, meaning they'll eventually reach zero.


1

So I worked out how to do this: Lets say I have object1, object2, object3 etc.... and these objects all use a common texture. I call my setTexture method (as detailed in my question) for object1 and then, instead of calling setTextures on the remaining objects, I created a new method and called that instead. public void bindExistingTexture(int ...


1

I suggest you change the way you render your vertices instead of trying to merge them. You are using immediate rendering. While good for debugging and proof of concept, it is "deprecated", and not a preferrable way to render when it comes to performance. You have several alternatives, but the most versatile and robust way I would recommend is using Vertex ...


1

This is possible using GL 1.x and here's how. So as you've found using vertex colors, a smooth transition is where it blends the two colors. This is a called a linear interpolation, or a "lerp" for short. It can be generalized to any dimension by operating on the elements of the vector individually and indeed colors are treated like a lerp in 3D -- blend R1 ...


1

I do not believe that this is directly possible using OpenGL 1.x. If you're using OpenGL 1.3, you can use Texture Combiners to merge two textures together in various ways, and you can even specify different sets of texture coordinates for the two textures, but I do not believe it's possible to set different opacities for the different textures per vertex ...


1

For the sake of easiness, use GLSL shaders. This is mandatory for modern openGL, anyway. Now, what you have to do is to unwrap your object to each texture. So you must associate to each vertex two texture coordinates in your vertex shader. Plus, you may wish to add a [0-1] value X to each vertex that tells how much of the first and second texture you ...


1

In your export script, you can ask for tessellated data so that you only have to deal with triangles and quads. Turning a quad into two triangles is trivial (as Byte56 has already answered). ob = bpy.context.active_object me = ob.data me.calc_tessface() for v in me.vertices: print("v", v.co.x, v.co.y, v.co.z) for f in me.tessfaces: if ...


1

Do not draw the same Sprite to represent the image at multiple locations. Holding the coordinates somewhere else - this defeats the purpose of object-oriented programming. The most memory is taken by the texture (or texture region) itself, the overhead of your custom class is negligible. Unless you will be making millions of Quads, do not worry about memory. ...


1

You can rotate the vertices before copying them into a vertex buffer. Something like: batch = vertex[SIZE] vbo = gl.CreateBuffer(SIZE * sizeof(vertex)) default_quad = { (-1,-1), (-1,1), (1,1), (1,-1) } transformed_vertices = vertex[4] draw(sprites) { for each sprite in sprites { matrix = sprite.CalculateModelWorldMatrix() ...


1

Take a look at this tutorial: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_basics.php . It is about terrains but you should be able to figure out how to combine "quads" (xna doesn't have quads, it is just 2 triangles) in one draw call.


1

The quad's center is the position (0, 0, 0) in local space. Local space is the space in which you define your vertex positions. For instance, if you draw your quad using the opengl glvertex* commands, you should specify each vertex relative to (0, 0, 0): glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left ...



Only top voted, non community-wiki answers of a minimum length are eligible