Jump to content
  • Advertisement

Archived

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

Liquid

Problems with Direct3D calls

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK--I have a standard Window''s messaging loop: while(true) { if(msg.message==WM_QUIT) { // do quit stuff } else { TranslateMessage( &msg ); DispatchMessage( &msg ); pRenderer->clear(); // render frame here pRenderer->swapBuffers(); } } // end while whenever there are no pRenderer->xxx() calls, this works fine and the window is responsive. Whenever there are, all of the processor cycles seem to get eaten up, and the main window won''t respond when you try and move it, etc. It will respond eventually, but still not at all like it should. I know it isn''t scene complexity, because if I remove everything but the pRenderer->clear() call, I have the same problem. All the clear() call does is: bool Direct3DRenderer::clear( dword dwColor ) { if(FAILED(pDevice->Clear( 0,0,D3DCLEAR_TARGET,dwColor,0,0 )) return false; else return true; } Has anyone had the same problem? Does anyone have a solution? This happens in both windowed and fullscreen mode. I am using initialization routines written by myself (not D3D framework or D3DX). Any help is appreciated. thanx, Liquid

Share this post


Link to post
Share on other sites
Advertisement
I''m not familiar enough with D3D to know if this even applies, but if your clear call can do anything that ends up generating a windows message (even one that you don''t explicitly process), you could be in trouble here. Of course, if that''s the case, I''m surprised you ever come out of it at all.

Share this post


Link to post
Share on other sites
Geforce 256 and latest drivers? Well then we have the same problem. I installed some old drivers and everything works but i couldn´t figure out what it was If you figure it out..tell me

Share this post


Link to post
Share on other sites
If you want the main loop to update every frame, then this is wrong. First I''m assuming you missed the PeekMessage in there by mistake.

So:

while(1) {
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
// Do frame related stuff here
}

or to delay a frame update until all messages are processed:

while(1) {
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
} else {
// Do frame related stuff here
}
}



Jim Adams

Share this post


Link to post
Share on other sites
I had the exact same problem on a voodoo banshee. I installed some different drivers and it worked fine. I don''t know exactly what the problem is, but I suggest getting the latest drivers for your card.

*** Triality ***

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You didn''t provide your implementation of the swapBuffers method, but you might try waiting for the vertical blank before you do your page flip... if you aren''t already

    
m_pDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0);
m_pddsPrimary->Blt(&m_rcScreenRect, m_pddsBackBuffer, &m_rcViewportRect, DDBLT_WAIT, NULL);


I''m not sure why this fixed the problem in my case, but it''s worth a try...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!