Solved

Bitmap background with OpenGL objects in front

Posted on 1997-04-28
1
1,083 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Issue accessing member variable of atomic class 16 116
PDF library for Delphi 2 121
Unresolved External Symbols 3 81
Issues with C++ Class 19 92
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

770 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