• Advertisement
Sign in to follow this  

a question about rendering in direct3d

This topic is 4266 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

Hi My question here is about rendering in direct 3d In all the tutorials and even on msdn the way to render is like this pDevice-> Clear(......) pDevice-> BeginScene //Render here pDevice-> EndScene pDevice->Present however, i have seen another way in the book i am reading and there are more steps : 1) clear the back buffer pDevice->Clear(.....) 2) Get a pointer to the back buffer pDevice->GetBackBuffer(....) 3) Lock the back buffer pDevice->LockRect(.....) 4) Render here //Render here 5) unlock the back buffer pDevice->UnlockRect() 6) release the pointer to the back buffer pSurface->Release() 7) and then present every thing again pDevice->Present(.... so my question is, what is the difference between the two methods ? of course some steps are the same but what about locking and unlocking the back buffer ? it seems to me that BeginScene will lock the back buffer and get a pointer to it and EndScene will unlock the back buffer and release the pointer . is that true ? the interesting thing is that in the first method, when i put a code to exit the program when i press the escape button , the responce was slower and if i don't show any thing on the screen then i have to press escape many times before it does something while this was not the case in the second method so if any one can explain to me about this, i will appreciate it Thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement