Background texture in opengl?

Oracle

New member
Does anyone know how do to apply a background texture to a program? does anybody know i looked on google but to no success
 
Code:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,1,1,0,-1,1);

Now your screen is (0,0) in the top-left corner and (1,1) in the bottom-right corner.

so

Code:
glBegin(GL_QUADS);
  glTexCoord2f(0,0);
  glVertex2f(0,0);

  glTexCoord2f(1,0);
  glVertex2f(1,0);

  glTexCoord2f(1,1);
  glVertex2f(1,1);

  glTexCoord2f(0,1);
  glVertex2f(0,1);
glEnd();
 
Yup.
You might need to use glDepthMask(GL_FALSE) before and glDepthMask(GL_TRUE) after it though in case you're going to mix 2d and 3d stuff.
 
Back
Top