drawprimitive 10000 times

Started by
24 comments, last by blue-ice2002 19 years, 2 months ago


thanks,that helped some,i mean i understood what u want to come up with,
but of course i have some things in my mind that make me think.That is

if i use INDEX buffer,and then reference to the vertices with theire numbers,
we come up with a problem with texturing.that is this

<><><><><><><>
<><><><><><><>
we have the tiles,for example we are at tile 1.
we matched the indices with vertices in correct order.
but in the texture,the last vertice of the first tile is also the first vertice of the second tile,so how will i match the texture to each quads?
Advertisement
Well number one you should not use triangle strips ... if you use straight triangles then the GPU will cache them much much better, caching vertices is half the battle for speed. Triangle strips are used to conserve bandwidth of sending vertices down the pipeline, I don't think modern GPU's are focusing on Triangle Strips anymore as much as they used to.. so change your plans to work with straight plain old triangles. This then means edges of Index Buffers can point to overlapped triangles without a problem. So your texture cords, can be somewhat independent if needed. I wouldnt worry about triangle count too much, when people talk about culling they are actually talking about gross culling, but we don't care because you are working with a lump of vertices that don't change, one Vertex Buffer call. Occlusion, is the real performance enhancer, because it reduces overdraw, not just sending stuff down the pipeline, but we don't have to worry about that either.

Anyway I wouldnt worry about # triangles u send, I would focus on getting those triangles that are in vid. memory to the screen as fast as possible. Now using Index Buffers, works well with GPU cache and again like I said because of style of camera view etc. you limit yourself to sending 4 index buffers max, which is excellent. Using overlapping vertices, you can get away with independent texture splattering without overhead. And because you are re-using Index Buffer patches (scrolling at steady pace) the GPU will love you.

Hope that helps. These are just my quick thoughts anyways.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org
of course you could always use dynamic vertex buffers, which would be slower but depending on your game it might not matter. Im using a dynamic vertex buffer for a similar top-down view tile based game, and Im pushing 800 tiles at about 600 fps on 2 year old hardware. For my simple game, the inefficiency of dynamic vertex buffers doesn't become a problem. This allows me to use more than one texture on the map, as the tiles are sorted by texture before going into the buffer, and then using one drawprimitive for each texture. it also allows me to dynamically change the map quite easily.

if you're having framerate problems though, dynamic vertex buffers could be out of the question. just something to consider.


hello,thanks for explanations aobut frame rate.maybe this could be the reason for the speed issue.
i mean in the main game loop
i do this

gamemain()
{
drawprimitive(20000)
}
should i give it a rate limit,i mean other than calling draw at each time,should i set the frame rate to a constant limit,for example
30 frames per second,means call draw 30 times in a second,cause for human being its enough.if i dont limit this,it calls milions times maybe,since there is no need for that much comoutation every milisecond?
Quote:Original post by blue-ice2002
call draw 30 times in a second,cause for human being its enough.


That depends on the game and the human being.

Quote:
if i dont limit this,it calls milions times maybe,since there is no need for that much comoutation every milisecond?

Unless it's causing a problem, well...what's the problem?
Stay Casual,KenDrunken Hyena


problem is,how can i use an index buffer to speed up the rendering process.

but,the textures are problem,i mean,


for rendering quads with indices,i use triangle lists,but because i use an indice,the second quads first vertex is also the last vertex of the first quad.
so,how can i set the texture for these 2 quads that share the same vertice?

This topic is closed to new replies.

Advertisement