Jump to content
  • Advertisement
Sign in to follow this  
ursus

OpenGL Displaying an image - newbie question

This topic is 4419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I'm aware this is probably a very simple question. I'd like to display an image (a bitmap or TGA) in OpenGL in the way it's independent on the scene rotation, lights etc. So called foreground pictule. Something like a cokpit or a user interface. Any hints and/or examples will be highly appriciated. Thank you

Share this post


Link to post
Share on other sites
Advertisement
Firstly find a library which will load image files (if you haven't already). I recommend FreeImage.
Then write an adapter class that will use the library to load an image, and create an OpenGL texture from it. You can draw that texture to screen using a full screen quad (could make a class for them aswell, they are pretty handy). To draw this FSQ (full screen quad) over the top of your scene irrespective of scene and camera transforms you need to reset the projection matrix to a 2D orthographic, and reset the modelview matrix. You can use gluOrtho2D to make this easier.
If you want the cockpit to update you need to work out how you want that done (if you give more details of exactly what instruments the cockpit will have then we can recommend methods).

Share this post


Link to post
Share on other sites
Actually I was thinking of this part of the game screen where information is presented (like score, and other data represented by spites and things). I'd say Rome TotalWar would be an example.

I guess I'd have to apply all the image modifications in some back buffer and once it's ready - display it as the quad with texture mapped to it as a 'fornt' image.

Is my way of thinking correct?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!