/* jcorso::nb - gr_opengl_tex.html */ int texname; /* id for the texture we'll be using */ ... glGenTextures(1,&texname); /* ask gl to generate a valid texture name (id) */ glBindTexture(GL_TEXTURE_2D, texname); /* select the current texture */ glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL); /* set the environment */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); /* load the actual texture into GL's memory */ glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,ph.width,ph.height,0,GL_RGB,GL_UNSIGNED_BYTE,tex); free(tex); /* we no longer need this memory lying around */ glEnable(GL_TEXTURE_2D); /* tell gl to use the texture */ ...