PDA

View Full Version : Background in OpenGL



TheGecko
10-15-2000, 07:21 AM
Hey OGL'ers,

OK I'm sure that this topic has been answered before but I can't seem to find the thread.I want to place a "2D" background in my OpenGL game and then render my 3D objects infront of it.How do I draw the background (a textured quad) without setting it too far into the screen? (You guys know what I mean? I'm trying to make a game like Alone in the Dar where you have a 2D background in the back but 3D characters walking around infront of it.)

Thanx in advance for any help.

10-15-2000, 07:46 AM
If you know your frustum is 1.0 to 1000.0,
you can just put a quad at 999.99 with the
texture stretched across it. This works great
if you know your objects will be closer than
that. However, some cards (i e Voodoo3 and
lower) can only do 256x256 textures, so the
solution I came up with was splitting the
background in six quads (three across, two
high) and use one 256x256 "slice" of the big
texture each.

If you know you are drawing indoors
environments, I imagine it might be easier to
work with (or think about) your scene if you
put the background texture(s) on a quad(s)
that are actually, in space, where your back
wall would be. In effect, the very basics of
a scene renderer without any special effects
like culling or BSP, might do well in a game
like what you're talking about.

zed
10-15-2000, 12:32 PM
use glOrtho2d(0,windowwidth,0,windowHeight,-1,1) (spelling might be wrong)
turn off the depth buffer writes and draw the background.
then setup your 3d viepoint and draw everything else.
one bonus is u dont haveto clear the colourbuffer now