Camera image behind an Inventor model?

Hi,

I have an OpenInventor application that I’m trying to put a live camera image in the background of. Using the image as a texture for some kind of surface is much too slow, so I’m using glDrawPixels.

My problem is that the image I draw with glDrawPixels keeps clipping my Inventor models. I’d like the image to be the background for everything else. Whatever I put into glRasterPos doesn’t seem to make any difference at all.

My current code for the drawing (in short):

glPushMatrix();
glLoadIdentity();
xzoom = (float)viewportwidth/640.0;
yzoom = (float)viewportheight/480.0;
glPixelZoom(xzoom, -yzoom);
glRasterPos4f(-1, 1, 1, 1);
glDrawPixels(640, 480, GL_RGB,
GL_UNSIGNED_BYTE, buf);
glPopMatrix();

What am I doing wrong? Can anybody help me?

Thanks a lot in advance,
Björn
bjoern@giesler.de

Björn,

After clearing the screen, draw the background image first, with depth buffer writes disabled. Then, after enabling depth buffer test and writes, draw the rest of your objects.

Also make sure your geometry isn’t clipped by the far plane…

HTH

Jean-Marc

Hi,

nope, still clipping. My code now:

glPushMatrix();
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glRasterPos4f(-1, 1, 1, 1);
glDrawPixels(640, 480, GL_RGB,
GL_UNSIGNED_BYTE, buf);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glPopMatrix();

I’m doing this from a callback node that is the first node in the scene graph, even before the camera. Maybe I’m misunderstanding something about the GL/Inventor relationship?

–Björn