Hello there!
I’m trying to display colored lines over a 2D texture, but the lines are always black.
...
// Display the OpenGL texture map
glColor4f(1,1,1,1);
glBegin(GL_QUADS);
int nXRes = g_depthMD.FullXRes();
int nYRes = g_depthMD.FullYRes();
// upper left
glTexCoord2f(0, 0);
glVertex2f(0, 0);
// upper right
glTexCoord2f((float)nXRes/(float)g_nTexMapX, 0);
glVertex2f(GL_WIN_SIZE_X, 0);
// bottom right
glTexCoord2f((float)nXRes/(float)g_nTexMapX, (float)nYRes/(float)g_nTexMapY);
glVertex2f(GL_WIN_SIZE_X, GL_WIN_SIZE_Y);
// bottom left
glTexCoord2f(0, (float)nYRes/(float)g_nTexMapY);
glVertex2f(0, GL_WIN_SIZE_Y);
glEnd();
// Draw the crosshair
glBegin(GL_LINES);
glColor3f(1.0f,0.0f,0.0f);
glVertex2f(GL_WIN_SIZE_X/2, 0);
glVertex2f(GL_WIN_SIZE_X/2, GL_WIN_SIZE_Y);
glVertex2f(0, GL_WIN_SIZE_Y/2);
glVertex2f(GL_WIN_SIZE_X, GL_WIN_SIZE_Y/2);
glEnd();
// Swap the OpenGL display buffers
glutSwapBuffers();
I only inserted the “Draw crosshair” part. It’s from a simple viewer program from OpenNI (a framework for accessing Microsoft Kinect).The texture is actually a depthmap of the Kinect camera. Now my lines are displayed, but always in black.
I already tried glDisable(GL_TEXTURE_2D); - the lines are red then, but there is no texture visible anymore, just a white background. I’m new to OpenGL and therfore lack understanding of the basic principles behind it
Help very appreciated.