Avatar of loengrin
loengrinFlag for Canada

asked on 

How to overlay a bitmap on an image in OpenGL

I would like to know the correct way to overlay a bitmap, such as an alphabetic character or an icon, on top of a bmp image that is drawn with glDrawPixels. I have tried using glBitmap to draw the bitmap and it works fine if I place the bitmap near the image origin. However, if the bitmap is placed some distance from the origin it starts to appear scrambled. The farther away from the origin the bitmap is placed the more scrambled it gets. However, if I do not display the underlying image, I can place the bitmap anywhere on the screen and it looks fine. Can anyone tell me why this might be happening?  Thanks very much.
Game ProgrammingC++

Avatar of undefined
Last Comment
trinitrotoluene
Avatar of trinitrotoluene
trinitrotoluene
Flag of Australia image

Avatar of loengrin
loengrin
Flag of Canada image

ASKER

Thanks for your reply.

Unfortunately I have not been able to make this work, because  I can not get a pixel format that supports multiple planes. Looks like my display does not have this capability.  
Avatar of trinitrotoluene
trinitrotoluene
Flag of Australia image

i am not sure i get what you are saying...you can do a setpixelformat() for each of the layers you are using....
Avatar of loengrin
loengrin
Flag of Canada image

ASKER

I guess I was confused - from reading this post from Microsoft  http://support.microsoft.com/kb/169954
I had the impression that hardware support for layer planes was required.

I haven't been able to find an example of how to set the pixel format for a layer plane other than the main plane, and my own attempts have not worked. If you could post an example of how to do this I  would appreciate it very much.
SOLUTION
Avatar of trinitrotoluene
trinitrotoluene
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of loengrin
loengrin
Flag of Canada image

ASKER

Thanks very much for the information. However, the documentation for the wglCreateLayerContext states that the layer context cannot be created until after a suitable pixel format has been found and selected, rather than before as you have suggested.

My problem is that I can't find a pixel format that allows multiple layers. When I enumerate all available  pixel formats using wglDescribeLayerPlane, none of them supports multiple layers (i.e. none returns bReserved > 0).  I am wondering if the implementation of OpenGL that I am using does not support  this feature.

Is it necessary to use layer planes in order to overlay a bitmap, such as a font character, on an image? If so, it looks like I am out of luck.

Thanks for your help.





































































































 , or is there something ?  
ASKER CERTIFIED SOLUTION
Avatar of loengrin
loengrin
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
great job at debugging the issue!
C++
C++

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

58K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo