View Full Version : fastest opengl rendering
08-20-2000, 06:04 AM
i'm porting my old software rendering code to openGL, and i have a little question:
¿which is the fastes way to render triangles/polys with opengL?
1.calling glBegin(GL_TRIANGLES) and drawing all the tris
2.using vertex arrays
3.usign interleaved vertex arrays
Well, it depends on how you store your data. If you store your data in such a way that you can use vertex arrays, then use it. You don't have to call OpenGL-functions for each vertex/normal/texturecoordinate and so on, so this is a way of gaining speed.
If you store all polygons like a linked list of polygons, or an array of polygons (where each polygonstructure holds three vertices, a normal, color and so on, for example), then the best way to draw might be using glBegin/glEnd pairs.
And interleaved arrays is almost the same as "regular" vertex arrays. Use this if it's suitable.
08-22-2000, 09:03 AM
The problem with calling a lot of glFoo() functions is that each function call creates a bit of overhead (the registers and return ip must be pushed on the stack). The solution is to use display lists, one call of the display list will batch execute a set of GL functions.
Sometimes a display list cannot be used, say you have dynamicly changing color values from dynamic lighting. In this case it would be optimal to use arrays.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.