Archived

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

Vertex buffers

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

Say, i have 3 spaceships that i want to render, and they will all move at the same time per loop. should i use 3 vertexbuffers and change/call the setstreamsource/drawprimitive 3 times and every frame?. or is there a better way?.

Share this post


Link to post
Share on other sites
Why do you have to change the vertex data at all? does the shape of the spaceship change over time? Do all spaceship at a certain time always look the same?

Share this post


Link to post
Share on other sites
so it will go something like this?


setstreamsource


int renderloop() {


copy-verticeship1-into-vertexbuffer0
d3dmatrix operation
settransform
drawprimitive

copy-verticeship2-into-vertexbuffer0
d3dmatrix operation
settransform
drawprimitive

copy-verticeship3-into-vertexbuffer0
d3dmatrix operation
settransform
drawprimitive


return 0;
}



correct?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
No, more like:

copy all vertices into vertex buffer, during load time, not run time, unless you want dynamic models


int renderloop() {

setstreamsource

d3dmatrix operation
settransform(space_ship1_matrix)
drawprimitive(space_ship1_start,space_ship1_number_of_prims);

d3dmatrix operation
settransform(space_ship2_matrix)
drawprimitiv(space_ship2_start,space_ship1_number_of_prims);

d3dmatrix operation
settransform(space_ship3_matrix)
drawprimitiv(space_ship2_start,space_ship1_number_of_prims);

return 0;
}

Share this post


Link to post
Share on other sites
Ahaaaa.

so u use only 1 vertexbuffer regardless of how many objects there is on the screen?.

So drawprimitive keeps the object apart with the startvertice and stop vertice?.

[edited by - Funkodysse on October 18, 2002 9:15:50 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you have alot of vertices, you should proabably use more vertex buffers. And if you use indexed primitives you can only index 65536 vertices per vertex buffer. For more information try nVidia''s papers. developer.nvidia.com

Share this post


Link to post
Share on other sites