Jump to content
  • Advertisement


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


Secondary surfaces DC?

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

Is it posible to write a bitmap on a device context taken from the secondary surface. The code that I''ve seen, makes a memory DC, writes the bitmap onto it, then copies that DC to a DC taken from the secondary surface and then blits it to the primary surface. Can I just select the bitmap into the secondary surface''s DC or must I do it like above? BTW I''m learning this from the Game Programming Genisis articles.

Share this post

Link to post
Share on other sites
You have to create another DC to hold your image. Like this:

//Lets just assume g_pSecondary is a valid pointer to our secondary surface



HDC SurfaceDC;
HDC ImageDC = CreateCompatibleDC(NULL);



The second device context is required for the BitBlt operation. You need two device contexts: one for the surface and one for the image itself. You select the handle to our bitmap into the ImageDC, and when you call BitBlt it acts as our source device context. Geddit?

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!