Amount of triangles in brute force terrain

Started by
3 comments, last by steg 22 years, 3 months ago
Hi, After the great help I got on here over brute force terrain, I was wondering what is the maximum number of triangles you can render ? I seem to be able only to do amounts of 16384 before everything messes up ? i.e. m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,16384); Then if I m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,32768,16384); crash occurs....How many triangles should be used in the call to DrawPrimitive - I take it it depends on the video card, but what is a safe number ? Also, using brute force for terrain is very slow but easy to implement (I will look at implementing ROAM algo''s later), how do I apply a texture to the scene - do I draw a texture of say size 256x256 and wrap/drape it over the whole terrain ? Kind regards, sTeVe

If it isn't working, take a bath, have a think and try again...

Advertisement
Your call to Draw Primitive is incorrect. You wrote:

m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,32768,16384);

That middle number that you set as 32768 tells directx which vertex to start at in the vertex buffer when drawing the triangles on the screen. You want to keep that at 0 so that you start drawing triangles from the first vert in your vertex buffer and increase the last number which you put as 16384 to see the number of triangles that you can render.

Actually all video cards have diffrent limits the number of triangles they can render. I think you can find out the limit of your video card by using the directx utility called the DX caps veiwer.

Hope that helps. .
~Wave


Search for MaxPrimitiveCount in the docs. Many of your questions should be answered. Incidently, this is explained in the docs for DrawPrimitive.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
To rephrase wavewash: to you have (32768)/3 + 16384 triangles in you buffer? If not, that could cause your crash.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Thanks guys,

WaveWash,

m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,32768,16384);

I thought this would tell dx to draw another 16384 triangles from the next lot of vertices in the buffer after the ones I''ve just drawn, maybe it should read :

m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,16384,16384); ?

Reason I use two DrawPrimitive''s is down to amount of triangles you can throw at the bus on a video card - trying to make it work for most types of video cards.

CrazedGenius : I have 256 * 256 triangles in my buffer.

Thanks for your comments and help.

sTeVe

If it isn't working, take a bath, have a think and try again...

This topic is closed to new replies.

Advertisement