Unstable framerate with a pattern

Started by
0 comments, last by Huga 21 years, 4 months ago
Hi. I have a problem with my framerate in my dx8.1 app. It goes 600, 100, 200, then back to 600 again. If I draw some more it goes like 300, 50, 80 etc. What I''m doing is that each frame I''m filling a vbuffer like this; m_vertexbuffer->Lock(0, 0, (BYTE **)&t2, D3DLOCK_DISCARD); memcpy(t2, m_vlist, sizeof(Vertex) * m_renderlistsize * 6); m_vertexbuffer->Unlock(); then I render it in pieces, sorted by texture. Something like this: m_d3dDevice->SetStreamSource(0, m_vertexbuffer, sizeof(Vertex)); m_d3dDevice->SetVertexShader(D3DFVF_Vertex); for(int t = 1; t < curtex+1; t++) { SetTexture(texchanges[t][0]); m_d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, start, texchanges[t][1] * 2); start += texchanges[t][1] * 6; } Oh, and the buffer is filled with 3000 vertices for the faster fps and 9000 for the slower. I''m only using one 64x64 texture so that can''t be a problem. The sdk samples works with a steady framerate so obvioulsy I''m doing something wrong here. Any tips appreciated. Thank you.
/ Martin
Advertisement
Hmm I just noticed something odd. When I comment out the rendering code I get a steady fps, but after uncommenting that code again, it suddently ran fine at 80 fps. But only the first time. I tried to reprocduce this, and I could, but it doesn''t work every time. Could it be that I''m I failing to release resources on the card, or something like that?
/ Martin

This topic is closed to new replies.

Advertisement