• Advertisement

Archived

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

Back buffers

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

Hey all, With what function can i copy the back buffer to the primary? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Perhaps it could help being a bit more specific? .. Which API?

thec

-------------------------
http://www.thec.org

Share this post


Link to post
Share on other sites
quote:
Original post by TheNerd Tk421
What is a buffer?


Don''t be stupid, a buffer is what you use to polish your car with

Share this post


Link to post
Share on other sites
OpenGL: SwapBuffers()

Direct3D: IDirect3DSwapChain9 :: Present (DirectX 9.0)
(Is this the only way in DirectX 9.0?)


[edited by - Waverider on August 18, 2003 2:08:33 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Waverider
Direct3D: IDirect3DSwapChain9 :: Present (DirectX 9.0)
(Is this the only way in DirectX 9.0?)

No.

IDirect3DDevice9 :: Present(); is more commonly used.


[edited by - glassJAw on August 18, 2003 2:10:17 PM]

Share this post


Link to post
Share on other sites
<< With what function can i copy the back buffer to the primary? >>

In Win GDI, that would be BitBlt, but make sure you are writing to the back buffer, and only copy to the primary when you are done each frame.

For OpenGL or DirectX see above messages.

Using Win GDI only, here is how I did it for my Vazteroids game

Vazteroids C Source GAME EXE

This is inside WinMain()

// erase the back buffer
FillRect(back_dc, &back_rect, black_brush);

GameMain(); // all drawing to back_dc buffer here

// copy back buffer to front buffer
BitBlt(game_dc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, back_dc, 0, 0, SRCCOPY);

In my game, game_dc is the primary, back_dc is the back, width = 800, height = 600, so back_rect is the rect struct 800 x 600 to erase back buffer. There is a tutorial on GameTutorials.com where I learned how to do this.

"Buffer" is just a fancy term for an area or placeholder of memory. Kinda like "engine" but even more ambiguous.

Phil P

Share this post


Link to post
Share on other sites

  • Advertisement