Specifying background (image) in a viewport?

How can I load a .bmp or .jpg image and set it as background for OpenGL viewport?
Thank you,

this you can do the following way:

  • load your background image as a texture

  • before rendering a frame, change to orthographic projection and render a quad that is exactly screen sized at a distance from the viewer that is nearly the far plane of the viewport

  • then, change to normal perspective mode again, and render the scene.


Sweet, thank you.