Archived

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

This topic is 5872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I have a quad engine the im using to draw an isometric map. I'm using static indexed primitives to draw about 200 tri's. For some reason, if I have meshes and other stuff I get high frame rates, I can add in all kinds of other code and it doesn't slow down a hair, but with the 200 tri's it's slow ass malassis. They are all using the same texture, which is 256x256 in memory. This is the indexed primitive code. Can someone tell me what here might be slowing it down almost to a crawl? If I comment out just the render call, the FPS shoots right back up to normal. So it's not the creation or memcpy of the map. Just the render. ???????? Any ideas? Thanks, Insodus

void Direct3D::CreateIndexedVertexBuffer(DWORD flags, LPDIRECT3DVERTEXBUFFER8 & vertbuff, LPDIRECT3DINDEXBUFFER8 & indbuff, int size, int num_elems, int num_inds) {
pD3DDevice->CreateVertexBuffer(size * num_elems, D3DUSAGE_WRITEONLY, flags, D3DPOOL_DEFAULT, &vertbuff);
if( FAILED(hRet) ) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error creating vertex buffer.", hRet);
}
pD3DDevice->CreateIndexBuffer(sizeof(WORD) * num_inds, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &indbuff);

if( FAILED(hRet) ) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error creating vertex buffer.", hRet);

}}

inline void Direct3D::RenderIndexedBuffer(D3DPRIMITIVETYPE type, DWORD flags, LPDIRECT3DVERTEXBUFFER8 vertbuff, LPDIRECT3DINDEXBUFFER8 indbuff, int size, int num_elems, int num_inds) {
pD3DDevice->SetStreamSource( 0, vertbuff, size );
pD3DDevice->DrawIndexedPrimitive(type, 0, num_elems, 0, num_inds / 3);
}


[edited by - Insodus on April 18, 2002 11:11:18 AM] [edited by - Insodus on April 18, 2002 11:12:24 AM]

Share on other sites
For optimal rendering you should send from 500-10,000 vertices per draw-primitive call.

Anything less and it will be progressively slower. There is a chart on the relationship between vertex fvf sizes, number of vertices sent per drawprimitive, and all sorts of other data on vertex buffers at developer.nvidia.com; check there.

Share on other sites
The site says about 500 tris is good and thats what I''m sending.

Share on other sites
G''day!

How large are these tiles that you''re drawing? Are you using mipmaps for your textures?

Stay Casual,

Ken
Drunken Hyena

Share on other sites
No, i have a texture of 256x256 and I divide it into 16 quads of 64x64. Then I am mapping a single 64x64 area of it to a 80x40 isometric tile.

Share on other sites
1) I had my renderer set at 2 texture stages even though I was only using 1, I tried fixing that. It did''t do much.
2) I tried changing the filter type, I had it set to bilinear, I tried linear and anisotropic; they all had about the same performance.
3) I tried messing with the texture coords a little. Seeing if applying more or less pixles to each quad did anything, it didn''t.
4) Then I messed with my render states. Most had little or no effect, this one jumped it about 10 FPS, but that was it.
D3DInst->pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

Again, its at about 60 FPS with just a render of about 550 tri''s. If I add a mesh with a few hundred tri''s it doesn''t change FPS at all. If I take away just the render call on the 55o tri''s the FPS goes up to aboout 170. What am I doing wrong here, this shouldn''t happen.

Share on other sites
I also tried setting the texture to null, so it just drew white. That only helped for 10 or so FPS as well.

Could the ordering of the triangles have anything to do with it?

I know my vertices are ordered right (clockwise) but the tri''s are kind of in a spiral pattern.

Share on other sites
If you create a d3d device with presentation params with the refresh interval set at default, then your apps frame rate will be limited by the refresh rate of your monitor, which can typically be 60hz.

Try setting FullScreen_PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE. (Also, you can try setting FullScreen_RefreshRateInHz to D3DPRESENT_RATE_UNLIMITED, but read up in the docs about the settings as well).

T

Share on other sites
I have tried this, but I know it''s not the refresh rate because it refreshes at 160+ fps with just the mouse drawn or with meshes. Just the 500 tri list makes it go down to 50''s

• 10
• 16
• 14
• 18
• 15