Archived

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

Vertex buffers for TnL

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

Sorry if this has been asked recently but I couldn''t see anything that looked like it might be the same sort of question on the BB. I have just got a new geforce2, my first TnL card. I had never bothered with vertex buffers or indeed indexed primitives so I decided that I would learn to take advantage of the TnL. I prototyped up a simple program that drew a car using one call to DrawIndexedPrimitiveVB and it works fine but I''m not sure about the way I have implemented a couple of points. Firstly I have the indexes in an array of DWORDS like the docs say, but surly if this is in system memory and the VB in video memory this is going to slow things down, is there a way to put the indexes in vidmem? Secondly, as all the texture coords are stored with the vertex data in the VB I have two real choices for texturing my car model, either I can have a large ''unfolded'' texture, but which will include lots of wasted space (which I could possibly use for other models, but am not at the moment) which would fill up the vidmem unnecessarily or I could replicate some of the vertices (in my simple car model it would be all of them) in the VB but with different texture coords so I can pack the texture more efficiently, but this would waste vidmem with extra vertexes. Is there some sort of conventional wisdom that should dictate what I should do? Thanks,

Share this post


Link to post
Share on other sites
Don''t worry - I''m currently working on an article dealing
with some of the stuff to do with addressing TnL hardware.

First off - don''t worry about the problem to do with the index
array. There''s no way you can get the indexes put into vidmem
instead of system. If your really concerened abotu performance
issues then try to reorganise your data into triangle lists or
even better triangle strips. Though to be honest I doubt that
having it as indexed lists is going to cause that much of a
performance issue really.

I think the choice you have to make over having a ''skinned'' model
where all the vertices share texture co-ords or having replicated
vertex data is really dependant on the size of the model vertex
data. Having a very small model i.e. < 200 polys ~ 600 verts if
you replicated all 3 vertices for each tri I think it would be
fine. Vertex data really isn''t the major concern for sending
across the agp bus. It''s probably going to be the smallest factor
with the textures being the largest. Though having a skinned model where you can reduce the vertex data is probably an optimal solution. But then again it also depends if you want to
be able to do things like dynamic mesh deformation for simulating
damage to the car aswell.

hope this helps

--
Code..reboot..code..reboot..sigh!

Share this post


Link to post
Share on other sites
Thanks, that''s just what I wanted.

At present I m just playing with the technology but it''s good to know I''m on the right track.

Share this post


Link to post
Share on other sites