View Full Version : interleaved arrays
11-26-2001, 06:25 AM
I am using a 3-d array of glutSolidCubes, each cube colored by data for that point. If I could use something like
glInterleavedArrays( GL_C3F_V3F, 0, ... );
and then something like
glDrawArrays( ..., 0, count );
It would seem like things would speed up, but I don't see how to specify glutSolidCubes rather than points, lines or polygons. If it can't be done this way, is there some other way that would make things faster than nested loops?
Rob The Bloke
11-26-2001, 07:13 AM
right then, glutSolidCube is a function call that creates a cube using polygons. It's generally better to use your own primitive types rather than the glut types.
You could use vertex arrays for the primitives, but it may be better to use display lists if all you want is a static cube. If you were going to use vertex arrays then you'd have to make the cube out of triangles or quads.
but I don't see how to specify glutSolidCubes rather than points, lines or polygons
you cant specify glutSolidCube's as openGL primitives, mainly because they aren't primitives and aren't part of openGL. (glut != openGL)
11-26-2001, 08:03 AM
Thanks, I'll have to look at redoing the work in primatives. Display lists haven't been useful for me. They seem to run slower than without. This might be a memory problem since I have about 900,000 cubes, each with color-data, in the list.
Rob The Bloke
11-26-2001, 08:22 AM
If you've got that many cubes, you might want to consider some sort of culling so they dont get to the render pipeline. This is of course presuming that not all the cubes are visible all the time. If they are, then if they get very small you might want to replace the cube with a point if the cube only fills a single pixel (or less)
Generally you should only need one display list of a cube, apply a different color before you draw it and translate it (scale & rotate also if needed) to the correct location. You shouldn't need multiple display lists.
display lists are the fastest way to draw geometry on most 3D cards. Vertex arrays come in a close second. . . . (ignoring extensions before anyone corrects me http://www.opengl.org/discussion_boards/ubb/smile.gif )
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.