ARB_compiled_vertex

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 Jul 24, 2003 at 14:11

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.

18 Replies

Please log in or register to post a reply.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 25, 2003 at 08:48

sure, i have some old code flying around… should i just send it to you by email ???

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 25, 2003 at 11:04

bether drop it in here.. so it get “backed up” for the world

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 25, 2003 at 12:17

sure !
hm, it might not be able to post it before tonight though… sry…
anyway, i hope it will be helpful

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 26, 2003 at 13:19

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

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 27, 2003 at 09:13

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();
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 27, 2003 at 12:46

and it normally only helps for multipass (means a lot of glDrawElements calls between the lock and unlock)

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 27, 2003 at 19:57

right, that would be the only real advantage of this extension. like if you are drawing one object over and over again.

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 Jul 28, 2003 at 11:56

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

Baaecfb3a09127d5bc5045f89025e49e
0
UnknownStranger 101 Jul 28, 2003 at 12:00

Well, it’s surely faster than calling glVertexXY for every vertex ;)

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 28, 2003 at 12:42

@rogerdv

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.

7f31d4c4bf8648e1257d77609430952c
0
Julio 101 Jul 28, 2003 at 15:50

got some sample code on my site: here

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 28, 2003 at 16:55

i forgot!!

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

here is the direct link..

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.

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 Jul 30, 2003 at 15:39

glDrawElements is any gl drawing function like glVertex?

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 Jul 30, 2003 at 15:46

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?

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 30, 2003 at 16:46

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

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 30, 2003 at 18:21

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…

C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Jul 31, 2003 at 20:47

off-topic

anubis: well-explained.

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

:yes:

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Aug 03, 2003 at 20:26

@rogerdv

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..)