Archived

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

Vertex Caching

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

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 on other sites
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 on other sites
And is there a way to query the cache size using OpenGL ?

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 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 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 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 on other sites
come to think of it, I have no idea how I got around that.
hmm

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

1. 1
2. 2
frob
13
3. 3
4. 4
5. 5

• 9
• 13
• 14
• 67
• 14
• Forum Statistics

• Total Topics
632132
• Total Posts
3004299

×