Archived

This topic is now archived and is closed to further replies.

Background images?

This topic is 5236 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

Is there any way to have a bitmap that''s always displayed behind the objects in my scene in OpenGL? I don''t want to have to create a big giant textured quad with my background image on it and stick it behind all the other objects in my scene.

Share this post


Link to post
Share on other sites
You have to wrap the bitmap texture with something! If you require a big quad then do it! nothing wrong with a huge quad. Skyboxes use the largest quad available in a 3D world

Share this post


Link to post
Share on other sites
What you probably want is to disable lighting and z-buffering and place several quads with a chopped-up texture in front of the camera. Do this before camera rotations/translations. Then you can re-enable lightning and z-buffering to draw your 3d objects.

Hope this helps.

Share this post


Link to post
Share on other sites
look:

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

glOrtho2D(0,1,0,1,-1,1);
//possible to swap 3. and 4. arg, when you see nothing...

glMatrixMode(GL_MODELVIEW);

glPushMatrix();
glLoadIdentity();
glRasterPos2i(0,0);
glDrawPixels(1024,768,GL_RGB,GL_UNSIGNED_BYTE,image);
glPopMatrix();

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);


I don't know whether it is without errors, i haven't my help here, so glDrawPixels may have bad num of arguments, or such problem.

(image is a pointer to loaded 24bit RGB bitmap flipped upside down, here with size of 1024*768*3 bytes)

[edited by - exa_einstein on August 11, 2003 10:09:16 AM]

Share this post


Link to post
Share on other sites
azimuth: How would I disable Z-buffering? I imagine that it''s glDisable(something), but I don''t know what flag to put in place of "something" to disable Z-buffering.

exa_einstein: I tried your code but my compiler complains that glOrtho2D() doesn''t exist.

Share this post


Link to post
Share on other sites
you can disable WRITES to the z-buffer with glDepthMask(0);
(and enable with glDpMsk(1); 1 is default)

Depth testing you can glEnable/glDisable with arg. GL_DEPTH_TEST

also you have glDepthFunc(GL_ALWAYS/EQUAL/LESS/LEQUAL/GREATER/GEQUAL/NEVER);

and if you want to completely remove z-buffer, you must set pixelformatdescriptor.DepthBits to 0 (i don't know whether it really exact ident pfd.DepthBits, so try msdn)

[edited by - exa_einstein on August 12, 2003 5:57:06 AM]

Share this post


Link to post
Share on other sites