View Full Version : Optimal rendering method for triangles:
09-25-2002, 05:55 AM
I am adding a pseudo 2D interface to my engine, using glOrtho and by rendering simple triangles to make quads facing the screen. My question is this: Since there are only6 vertices (cant I make them 4 by using triangle strip?) should I use vertex arrays or glVertex3*?
09-25-2002, 06:09 AM
Immediate mode won't hurt performance at all here, depending on how many triangles you are drawing (just 2 for a single quad?).
09-25-2002, 06:13 AM
Yes, 2 triangles for a quad, of course. In D3D, there was D3DPT_TRIANGLESTRIP flag, so instead of rendering 6 vertices, you rendered 4 in my case, as the 2 are the same. Is there a way to do it in GL? I know it can be done with vertex arrays, but I would rather not use them for such a simple task as rendering a quad.
09-25-2002, 06:16 AM
Oh, but I forgot to ask. Im planning to use the 2D interface for a GUI (i got it to work with GDI coordinates, its fine), so if I have several quads and lines rendered with immediate mode, that would hurt performance, right? We are talking for about 10-12 quads at maximum though, thats 20-24 triangles -> 180 vertices?
09-25-2002, 06:22 AM
Yes, OpenGL can also do triangle strips. Just use GL_TRIANGLESTRIP where you would normally have done GL_TRIANGLES. In your case you could also use GL_QUADS, but you should only use that if you are certain that all 4 vertices are coplanar.
09-25-2002, 06:26 AM
Oh I see now. Yes, I don't like using GL_QUADS because the vertices might not be coplanar.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.