Jump to content
  • Advertisement
Sign in to follow this  
avocados

Compiled vertex arrays (psuedo code)

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Or is it a "Static Vertex Array"? I'm rendering multiple passes on a heightmap and just throwing that into a display list. It sounds like CVAs would be the best way to speed this up. Is the array supposed to be in a VBO? I'm just testing with a straight glDrawElements call without display lists right now. The explanations I've found seem pretty straight forward but my program crashes. defineVertexPntrs(); glLockArraysEXT(0, 512*512*2); for(int i = 0; i < 512; i++) glDrawElements(GL_TRIANGLE_STRIP, 512*2, GL_UNSIGNED_INT, &mesh_indices[i*512*2] ); glUnlockArraysEXT(); [\code]

Share this post


Link to post
Share on other sites
Advertisement
This is why it should be forbidden by law to use constant numbers in code. I have no idea what those constants represent :)

I rewrote your code using named constants. If you define those with the corresponding numbers, it should work:

defineVertexPntrs();
glLockArraysEXT(0, NUMBER_OF_VERTICES_IN_VERTEX_ARRAY);
for(int i = 0; i < NUMBER_OF_STRIPS; i++)
glDrawElements(GL_TRIANGLE_STRIP,
NUMBER_OF_INDICES_PER_STRIP,
GL_UNSIGNED_INT,
&mesh_indices[i * NUMBER_OF_INDICES_PER_STRIP]);
glUnlockArraysEXT();




Edit (some extra info): My guess is that your app crashes because 512*512*2 does not correspond to the number of vertices in your vertex array. But there is now way for me to tell what 512*512*2 is supposed to mean...

Note that in using this efficiently, you require all your multiple passes to be drawn before the glUnlockArraysEXT() and you cannot draw any other vertex arrays in between. I believe the latter is the reason why VBO's are invented. And those may be more suitable for your application if your graphics card supports it.

Tom

[Edited by - dimebolt on August 15, 2005 8:07:40 AM]

Share this post


Link to post
Share on other sites
aarggh... no!
Stop right now!

The compiled vertex array extension is dead.
It should be taken out to a ditch somewhere and shot.
Apart from intel built in gfx chips it has no practical benifit on anything since probably the GF2.

Switch to using a VBO now and forget about the CVA extension, pretend it doesnt exist, if you cant do that get a Jedi or one of the men in black to wipe your memory.

seriously.

Share this post


Link to post
Share on other sites
Good to know. Is there a VBO-compatible mechanism for cutting down redundant vertex transformations, like say two triangle strips that share an edge lengthwise?

Share this post


Link to post
Share on other sites
Quote:
Original post by avocados
Good to know. Is there a VBO-compatible mechanism for cutting down redundant vertex transformations, like say two triangle strips that share an edge lengthwise?


Modern graphics cards have a vertex cache, which caches transformed vertices. This varies in size between cards ( I think it was about 17 for a GF4 ). So depending on how you send the data to your card, can have an impact on speed - due to cache usage.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!