Jump to content
  • Advertisement

Archived

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

trekey19966

Bitmaps and back_buffers

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

Advertisement
which platform or API are you planning to use, win32, opengl, dx?

loading bitmap is not that difficult. you can find source code easily I guess (try www.wotsit.org or google)

and back buffer usage changes from API to API..

In Win32 (with simple gdi functions), you CreateCompatibleDC with your current dc (drawing context) and draw there
here is the code I use for initialization
  
// creating a dc compatible with parent window

m_pDC = new CDC;
m_pDC->CreateCompatibleDC(parentDC);

// creating abitmap for the new dc (parentDC is passed to here as a CDC* from the main window)

HBITMAP hbitmap = CreateCompatibleBitmap(parentDC->m_hDC, m_iWidth, m_iHeight);
DeleteObject(SelectObject(m_pDC->m_hDC, hbitmap));

// initializing the new bitmap to all white

m_pDC->BitBlt(0, 0, m_iWidth, m_iHeight, NULL, 0, 0, WHITENESS);


then I do all my drawing operations on newly created m_pDC.. when I finsih everything, I call
pDC->BitBlt(left, top, m_iWidth, m_iHeight,m_pDC, 0, 0, SRCCOPY);

what you should do is to load your bmp, copy it to backbuffer (m_pDC) ant then BitBlt it to original (active) pDC

in OpenGL, you just initialize your window with back buffer support and call SwapBuffers after you draw your stuff

for dx, I have no idea..

I hope this helps

-----------
my quote is under construction

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!