Solved

Bitmap background with OpenGL objects in front

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

860 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