Solved

Bitmap background with OpenGL objects in front

Posted on 1997-04-28
1
1,094 Views
Last Modified: 2008-03-10
Hi!

I have a bitmap (CBitmap) I want to use as a background when drawing OpenGL
objects on top of it (Visual C++ 4.0 in Windows 95), but I don't get it
right...
The OnDraw function works fine when drawing just the OpenGL objects, but
when trying to draw a background first, the screen just flash between the
OpenGL drawing and the background... (terrible!)
I use the following call to draw the background:

pDC->BitBlt(0, 0, m_cxWnd, m_cyWnd, m_pDCMem, 0, 0, SRCCOPY);

m_pDCMem is a DCD and gets a bitmap object from:  m_pDCMem->SelectObject(
pBM),  (pBM is a CBitmap object)

Do I have to use an OpenGL command to draw the background bitmap or is
there another solution?

Thanks!!
0
Comment
Question by:Krafer
1 Comment
 
LVL 10

Accepted Solution

by:
RONSLOW earned 200 total points
ID: 1163014
Don't use double buffering in OpenGL if you wish to mix GDI (eg BitBlt) with OpenGL.

If you still want the smoothness of double buffering, try rendering into an off-screen bitmap into which you first draw your background image (using BitBlt).

Using an off-screen bitmap for your rendering also gives you the advantage that you can print the view (you cannot directly render to a pritner device context)

For further info, you can eMail me on Roger_Onslow@compsys.com.au
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TCP/IP Socket - connection close results in data lost 14 151
how to convert c++ code to Android App 3 128
Why isn't object file created? 6 86
designing in object programming 12 104
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question