Skip to main content
gamedev.net
🔒 Locked

Vertex Array draw pointer array ??

Started by Kincaid Sep 23, 2006 at 8:11 PM 2 replies 700+ views
Original Post
Kincaid
Kincaid
hello, i was wondering, is there a way to draw an array of pointers to vertices instead of drawing an array of vertices. This would be a great benefit, since you wont need an array of concrete values, but simply a pointer array pointing to any geometry on the same note, are there ways to not only allocate memory size, but also to control which blocks come next to which. With this you could make sure vertices align in memory.
Morpheus011
Morpheus011
the closest thing to what you're looking for is indexed vertex arrays or vertex buffer objects. Using pointers may actually be a performance issue because you're doing two levels of indirection instead of just one.

Also, there's no need to control which blocks come next to which because an array is inherently contiguous in memory. Using a vertex array garauntees that the verts will align in memory.
Kincaid
Kincaid
one array will be aligned yes, but i
m searching to lign up ALL my geometry.

the idea for thusfar;

I have a e.g. cube class (object with 8 vertices)
I have a linked list somewhere with a linked list of vectors
Lets say I have 12 cubes
I make the cubes, setting only each of their 8 vertices (highest edit level)
I link all the vertices from all the cubes in my linked list in a quad-wise manner (to draw quads in the end).
so a list of pointers of the entire structure 12 cubes, quad wise, ready for drawing quads (while only maintaining the original 8 vertices per cube as concrete values).
the list, when done filling, is tranformed to a pointer array, containing an aligned array of pointers.

this is what i would like to pass to the vertex array's. I know this doesn't work (simply passing the first pointer), so i make, when needed, a concrete array of vectors, which is aligned, and so ok to draw


ideally i would like to control memory alignement of the concrete 8 vetices per cube, all of them. or find a way to pass the pointer array to vertex arrays
Kalidor
Kalidor
If I'm understanding you correctly, what you want is not possible. You can pass an array of vertex arrays using the GL_EXT_multi_draw_arrays extension, but it is equivalent to calling glDrawArrays or glDrawElements multiple times.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.