Original Post
Hi, I am writing a 2D game, and i am suprised by VERY bad performance. I am drawing only 2 triangles(NO TEXTURES), and some lines(bullets). The thing is that fps is around 80 and after 5 or so seconds it drops to 15, then again for some time is ok(~80fps) and then it drops again to 15 and so on... I tried on my friend computers and it's the same only worse. (The funny thing is that my system specs are much lower than his and i am getting better fps!) Here's exe, take a look. Here's initilization code: (i am running in windowed mode) By the way i draw all my primitives using DrawPrimitiveUP() function, i dont use vertex buffers. (I am using June 2005 SDK) Any ideas? [Edited by - Jnz86 on August 28, 2005 10:51:10 AM]
WNDCLASSEX wc =
{
sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0, 0, GetModuleHandle(NULL),
0,0,0,0, "SolarCombat",0
};
RECT rec;
rec.top = rec.left = 0;
rec.right = 1024;
rec.bottom = 768;
AdjustWindowRect(&rec,WS_OVERLAPPEDWINDOW,false);
RegisterClassEx(&wc);
hWnd = CreateWindow("SolarCombat", "Solar Combat", WS_OVERLAPPEDWINDOW,
0,0,rec.right,rec.bottom, GetDesktopWindow(),0,wc.hInstance,0);
//D3D stuff from here!
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = true;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
g_D3D = Direct3DCreate9(D3D_SDK_VERSION);
if(!g_D3D)
return;
if ( FAILED(g_D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dpp,&g_D3DDevice)))
if ( FAILED(g_D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd, D3DCREATE_MIXED_VERTEXPROCESSING,&d3dpp,&g_D3DDevice)))
if ( FAILED(g_D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&g_D3DDevice)))
return ;
