Index/Vertex Buffers for meshes

Started by
4 comments, last by PolyVox 15 years, 10 months ago
hi, I'm trying to render a mesh using direct3d's index and vertex buffers, I usally process each polygon in the scene(clipping, transform, project) and then simply render it, but I've heard that filling the vertex index buffer on each pass and then sending to the GPU would not get as good a performance as filling the whole buffers with the screen space data and then sending this off to the GPU, the problem is that I have know way of knowing how many vertices(once clipped) there will be in a scene and also I would have to store a buffer for each mesh. simply - how would you normally render meshes/scenes using the vertex and index buffers(without TnL)?
Advertisement
Quote:Original post by staticVoid2
...I've heard that filling the vertex index buffer on each pass and then sending to the GPU would not get as good a performance as filling the whole buffers with the screen space data...


I'm not sure what you mean by 'filling with screen space data'. The usual approach is to store you object space vertices for a given mesh in a vertex/index buffer. You can then render the same object in different places by applying different object to world transformations.

You do not (in most circumstances) need to refill the buffers each frame.
so when the object is transformed, clipped and projected for a certain frame - how is the data(triangles) usually passed to the graphics card?
It's not - you have already filled the vertex and index buffers before you start rendering frames. Then, for each frame, you simply call a function (I think it is DrawPrimative() in Direct3D?) and specify which vertex/index buffer to draw from. Of course your transformations can, and usually do, change per frame.

Also, you can change the contents of the buffers later. I'm just giving the basic case.
Quote:Original post by PolyVox
It's not - you have already filled the vertex and index buffers before you start rendering frames. Then, for each frame, you simply call a function (I think it is DrawPrimative() in Direct3D?) and specify which vertex/index buffer to draw from. Of course your transformations can, and usually do, change per frame.

Also, you can change the contents of the buffers later. I'm just giving the basic case.


I'm rendering 2D triangles not 3D, I think you are meaning that I put all the objects 3d vertices in the buffer and render each frame using direct3d's own transform functions, I'm trying to render screen space primitives which means I will probaly have to fill the vertex/index buffers each frame, I was wondering if this is the way it is normally done(to fill the buffers with all triangles) or do you simply fill the buffers with one triangle, send it to the GPU and then move on to the next triangle in your scene and repeat?
Ah, sorry, I misunderstood you. I didn't realise you were rendering screen space primitives in 2D. Now I'm not so sure I'm afraid...

This topic is closed to new replies.

Advertisement