Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: is it possible to display a background image ?

  1. #1
    Guest

    is it possible to display a background image ?

    is it possible to replace the background color by an image, loaded from any bitmap file for instance or from a HBITMAP created elsewhere ? i mean, without having to load a texture from a bitmap of a 2power-dimension and to put it far on the Z-axis ...

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    1

    Re: is it possible to display a background image ?

    Yes, use the "glDrawPixels" function to write the image data to the frame buffer.

    (In the event that you wanted to use a texture, you could switch to an ortho-graphic projection [2D view] so you don't need to put it "far" on the Z-axis. "glOrtho" or "gluOrtho2D" can create ortho-graphic projections).

  3. #3
    Guest

    Re: is it possible to display a background image ?

    ...and remember to either disable depth buffer writing when you draw the quad, or clear the depth buffer after drawing it.

    No, there's no specific OpenGL concept of a background image. But as Guest points out, it's a really easy thing to do yourself.

  4. #4
    Intern Contributor
    Join Date
    Jan 2001
    Location
    Irving TX USA
    Posts
    58

    Re: is it possible to display a background image ?

    Have you researched glOrtho2D? nehe.gamedev.net has a good tutorial on it - you'll get much, much, much faster performance if you draw a textured quad in ortho mode than if you use glDrawPixels. The only drawback is you have to play around a bit with depth testing and depth masking to get it to work. My city demo kind of does that at http://daltxcoltsfan.tripod.com - check DoOrthoModeRendering in main.cpp. I had code in there to draw a quad on the screen that's commented out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •