PDA

View Full Version : Sumilating A Background Image



Midhas
03-14-2005, 06:44 AM
Hi,

i am totally new in programing OpenGL-Stuff.

I try to program a cool featured tool for windows-desktop. Hope that i may introduce it here when its finished...

But first i have some questions :-) Of course i have...

I need to simulate an background image behind my "normal" drawn 3d-world. Hope it's clear what i want to do... I want to draw an image first on the screen and then draw 3d-world above it... I tried so hard to figure out how it should work. But it doesn't.

I tried to draw the picture in glOrtho()-Mode, switched to 3d-perspective, draw my 3d-scene. but nothing happened. The picture was in Front of my scene...

Then i tried to draw the picture some in the depth of the z-buffer, like anormal 3d-projection. But the problem was that i didn't know how huge i had to make the textured Quad that there were no empty space between the picture and the window-frame...

I hope i told you clearly about my problem an hope further on that somebody can help me...

By the way, how can i increase or decrease the quality of textures ?

Thanks a lot
Midhas

Aeluned
03-14-2005, 06:58 AM
You were on the right track using glOrtho.

switch to glOrtho and draw your background and be sure to disable z-buffer writes (glDepthMask(GL_FALSE)). This ensures that you won't write any values to the z-buffer so that when you go to draw the rest of your scene it won't take the background into consideration when performing depth testing.

Now, switch to perspective and enable depth writes (glDepthMask(GL_TRUE)).
You'll also want to use depth testing most likely (glEnable(GL_DEPTH_TEST)).

try that out.

Edit: The quality of a texture is governed by its resolution. There are filtering methods and mipmapping available to you in OpenGL, but a texture will never have a higher quality than the resolution it was created at.

Midhas
03-14-2005, 08:46 AM
Hey :-) that works fine... Thanks dude.