Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Corrail

Vertex Caching

This topic is 5741 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

Hi all! I want to use vertex caching with opengl. I want to calculate the vertex values (such as position, color, ...) before drawing them with a primitive (for example for meshes). If I''m using vertex arrays the vertex values are calculated when using the glDraw* commands, aren''t they? But how can I calculate them before use? Thanks for each answer! Corrail

Share this post


Link to post
Share on other sites
Advertisement
quote:

If I''m using vertex arrays the vertex values are calculated when using the glDraw* commands, aren''t they?


Yes, at first time use.

quote:

But how can I calculate them before use?


You can''t. OpenGL''s vertex array transform system operates using an on-demand, lazy-evaluation concept. A vertex gets only transformed, if an indexed primitive actually uses it (ie. by pointing an index onto it). Then, once computed, it will get stored in an internal vertex cache. As soon as a further primitive (from within the same vertex array) reindexes the same vertex, it will not be recomputed but directly taken from the cache. The cache has a limited size, though, the exact amount depends on your particular hardware.

Share this post


Link to post
Share on other sites
not as far as I know.
the only thing I definitly know is that the cache size for most directx 7 class hardware (GF 1,2,4mx, not sure about ati here) is that the cache is 16 vertices long, but due to the way it is utilized, it''s effectivly only 10.
This means that drawing terrain in strips of 10 vertices, then moving across a row, can see a massive boost in T&L performance (I saw a good 45% fps boost when I did this a long time ago)

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |

Share this post


Link to post
Share on other sites
RipTorn : Are you using triangle strips & degenerated triangles or plain triangle lists? You can have simmilar speed-ups when using zig-zag pattern (one row to right, the next to left...)

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
triangle strips with degenerate triangles in between...
the way was simply instead of using the ''common'' method of drawing the terrain as a number of rows of triangle strips, I simply drew them:





9--10
\ \
\ \
7--8 \
\ \
\ \
5--6 \ 15-- etc
\ \ \
\ \ \
3--4 \ 13-14
\ \ \
\ \ \
1--2 \11-12


ignoring the gap in between though...

that way when it gets to 11, that vertex is still in the cache of 10 (number 2).. as will be 13.. etc.
it''s the same for the next row...
the end result is that vertex transforms nearly half, hence the 45% fps improvment I got...

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |

Share this post


Link to post
Share on other sites
Don''t your degenerated triangles mess up the rendering ? Unless the shape is convex, you would expect overlapping faces, isn''t it ?

Share this post


Link to post
Share on other sites

  • 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!