# ARB_compiled_vertex

18 replies to this topic

### #1rogerdv

Member

• Members
• 99 posts

Posted 24 July 2003 - 02:11 PM

Can somebody provide a simle example about how to use compiled vertex arrays? I know it is almos tobsolete, but it is the only extension supported by my video card.

### #2anubis

Senior Member

• Members
• 2225 posts

Posted 25 July 2003 - 08:48 AM

sure, i have some old code flying around... should i just send it to you by email ???
If Prolog is the answer, what is the question ?

### #3davepermen

Senior Member

• Members
• 1306 posts

Posted 25 July 2003 - 11:04 AM

bether drop it in here.. so it get "backed up" for the world
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #4anubis

Senior Member

• Members
• 2225 posts

Posted 25 July 2003 - 12:17 PM

sure !
hm, it might not be able to post it before tonight though... sry...
anyway, i hope it will be helpful
If Prolog is the answer, what is the question ?

### #5anubis

Senior Member

• Members
• 2225 posts

Posted 26 July 2003 - 01:19 PM

sorry, i couldn't find the code file. maybe it got deleted during one of the last windows reinstalls i did... sorry that i couldn't help
If Prolog is the answer, what is the question ?

### #6anubis

Senior Member

• Members
• 2225 posts

Posted 27 July 2003 - 09:13 AM

well, actually there isn't much code to supply anway... :)
just load the extension and then you just have to wrap your drawing routines with calls to

glLockArraysEXT(first_element, count);

glDrawElemets(...);

glUnlockArraysEXT();


If Prolog is the answer, what is the question ?

### #7davepermen

Senior Member

• Members
• 1306 posts

Posted 27 July 2003 - 12:46 PM

and it normally only helps for multipass (means a lot of glDrawElements calls between the lock and unlock)
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #8anubis

Senior Member

• Members
• 2225 posts

Posted 27 July 2003 - 07:57 PM

right, that would be the only real advantage of this extension. like if you are drawing one object over and over again.
If Prolog is the answer, what is the question ?

### #9rogerdv

Member

• Members
• 99 posts

Posted 28 July 2003 - 11:56 AM

Just that? Seems less clear that vertex buffers. Does it allow to optimize a 3ds model drawing?

### #10UnknownStranger

Valued Member

• Members
• 139 posts

Posted 28 July 2003 - 12:00 PM

Well, it's surely faster than calling glVertexXY for every vertex ;)
M.E.
-----
"Human stupidity is something you can rely on." -- M.A.
"I didn't design life." -- J.G.
"It's almost finished..." -- EHD

### #11davepermen

Senior Member

• Members
• 1306 posts

Posted 28 July 2003 - 12:42 PM

rogerdv said:

Just that? Seems less clear that vertex buffers. Does it allow to optimize a 3ds model drawing?
as we said yet: if you do multipassing for making fancy material effects or so on your meshes, then yes.
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #12Julio

New Member

• Members
• 7 posts

Posted 28 July 2003 - 03:50 PM

got some sample code on my site: here
<a href='http://julio.programmers-unlimited.com' target='_blank'>My Crappy Homepage</a>

### #13davepermen

Senior Member

• Members
• 1306 posts

Posted 28 July 2003 - 04:55 PM

i forgot!!

on OpenGL on Nutty.org, there is a demo with source as well!!

Quote

This shows how to use COMPILED VERTEX ARRAYS (CVA's). Using the Lock and Unlock functions, we can tell OpenGL that the vertices will not be modified, so it can cache the transformed vertices from the last pass, in multi pass rendering.

Uses a nice trick to depth sort the transparent object.

Uses Glut.

davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #14rogerdv

Member

• Members
• 99 posts

Posted 30 July 2003 - 03:39 PM

glDrawElements is any gl drawing function like glVertex?

### #15rogerdv

Member

• Members
• 99 posts

Posted 30 July 2003 - 03:46 PM

Another doubt, how can compiled vertex optimize drawing of animated models? I think, as the vertex coordinates changes, you need to *recompile* the vertex list, isnt it?

### #16Ed Mack

Senior Member

• Members
• 1239 posts

Posted 30 July 2003 - 04:46 PM

Really you'd use vertex lists for complicated stuff you replicate a lot, say like a patch of grass that gets duplicated lots to make a randomish field, or some statue in your game. Animation models are usually not too complicated and tweened/boned in realtime

### #17anubis

Senior Member

• Members
• 2225 posts

Posted 30 July 2003 - 06:21 PM

rogerdv : usually you store an object's geometry in object space. when you draw the object you simple apply the object's view matrix to scene and render the object. this way you never need to apply all the transformations and rotations to the object's vertices yourself.

yes, glDrawElements is an opengl drawing function it gets passed a list of indices that you want opengl to draw from a set of previously passed vertices. vertex data is passed like this. since you specifically asked for the compiled vertex array extension i assumed that you are familar with regular vertex buffers

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, your_vertex_data_here);

glDrawElements(GL_TRIANGLES, number_of_indices, GL_UNSIGNED_INT, index_data);


additionally you can also enable and pass the following data to opengl

GL_NORMAL_ARRAY
GL_COLOR_ARRAY
GL_TEXTURE_COORD_ARRAY

the names shuold be self explanatory...
If Prolog is the answer, what is the question ?

### #18donBerto

Senior Member

• Members
• 369 posts

Posted 31 July 2003 - 08:47 PM

off-topic

anubis: well-explained.

simply put, models that don't change are best placed in a vertex array.

:yes:
Imagine.

### #19davepermen

Senior Member

• Members
• 1306 posts

Posted 03 August 2003 - 08:26 PM

rogerdv said:

Another doubt, how can compiled vertex optimize drawing of animated models? I think, as the vertex coordinates changes, you need to *recompile* the vertex list, isnt it?
as i said, only for multipass, means drawing the EXACTLY SAME MESH several times A FRAME!

it doesn't even help over different frames.. as locking means transformation, and in every new frame, you transform the mesh slightly different (as your camera moves..)
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users