Solved

Bitmap background with OpenGL objects in front

Posted on 1997-04-28
1
1,073 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now