Sign in to follow this  
maldakkak

a question about rendering in direct3d

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this