Archived

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

multipass, send vertices to card for every polygon every pass?

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

i have to draw my polygons several times every frame, do i really need to send the vertices to card for every polygon every pass? vertices coordinates will be changed every frame, and calculcated by myself,(yes, i dont use glrotate, gltransform ) i dont draw every polygon in the sence(of course), it is not good to send all vertices once with vertex array every frame

Share this post


Link to post
Share on other sites
It depends. Generally, if you do multiple passes, the 3D card will process vertices multiple times. This is why multitexturing should be used as much as possible instead. If your multiple passes can be combined into a single one using more texture units, then you should definitely do that.

If not, there are still ways to speed it up: VAR/VAO. Using the vertex_array_range (for nVidia) or vertex_array_object (for ATI) extensions, you can cache the vertex array directly on the 3D card''s VRAM or AGP RAM. The vertices will still be processed multiple times when doing multipass rendering, but they won''t be transfered over the bus anymore. Geometry in VRAM is fast as hell.

And then, there is still the (evil) CVA extension. By itself, it''s a good idea: it supposedly caches the transformed vertex positions, so that multiple passes can reuse that information. Unfortunately, this functionality is very hard to achieve on modern 3D hardware (with vertex shaders it becomes really hard to choose the information to cache - even the vertex positions could change between passes), so CVA does anything between absolutely nothing to normal VAR caching. Basically, the CVA extension is evil and should be avoided. Still you can try it, perhaps it will give you a speedup in your particular case. The upside is, that it''s extremely easy to use.

/ Yann

Share this post


Link to post
Share on other sites
yes, i use multitexturing, but just not enough texture units for most of the cards,
u have mentioned NV_vertex_array_range and ATI_vertex_array_object can cache the vertex array,
what about GL_VERTEX_ARRAY?
and
seem GL_VERTEX_ARRAY and NV_vertex_array_range are just support one array, arnt they?

Share this post


Link to post
Share on other sites
quote:

u have mentioned NV_vertex_array_range and ATI_vertex_array_object can cache the vertex array,
what about GL_VERTEX_ARRAY?


If you mean GL_EXT_vertex_array, that''s very old and outdated. It simply is the standard vertex array functionality packaged in an extension for OpenGL version prior to 1.1 (where it was made part of the core). Forget about it.

quote:

seem GL_VERTEX_ARRAY and NV_vertex_array_range are just support one array, arnt they?


No, they allow for any number of vertex arrays you like. As long as they fit into the allocated memory. VAR lets you define a single memory range, but you can stuff as much vertex arrays into it as you like (or better: as there is memory available). VAO works a little different, it''s even easier as it lets you define separate vertex objects.

/ Yann

Share this post


Link to post
Share on other sites
assume i use VA, VAR or VAO,
i have 3 textures, say texA, texB and texC,
in 1st pass, i draw texA and texB,
2nd pass, only texC,
and i put all vertices and texture coodinates of texA in vertex array,
can i do the following?
thx

after 1st pass,
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glClientActiveTextureARB(GL_TEXTURE1_ARB);

for each triangle in 2nd pass,
glBegin(GL_TRIANGLES);
glTexCoord2f( current_texC_cood_V0_S, current_texC_cood_V0_T );
glArrayElement( current_triangle_V0 );
glTexCoord2f( current_texC_cood_V1_S, current_texC_cood_V1_T );
glArrayElement( current_triangle_V1 );
glTexCoord2f( current_texC_cood_V2_S, current_texC_cood_V2_T );
glArrayElement( current_triangle_V2 );
glEnd();


[edited by - iwaskia on October 23, 2002 12:10:28 AM]

Share this post


Link to post
Share on other sites
oops... glClientActiveTextureARB is new to me,
i am a lazy guy, i just copy glClientActiveTextureARB from other post,
i mean glActiveTextureARB originally,
with glClientActiveTextureARB, i think i know how to do it,
thx

Share this post


Link to post
Share on other sites