1 /* jcorso::nb - gr_opengl_tex.c */ 2 3 int texname; /* id for the texture we'll be using */ 4 5 ... 6 7 glGenTextures(1,&texname); /* ask gl to generate a valid texture name (id) */ 8 glBindTexture(GL_TEXTURE_2D, texname); /* select the current texture */ 9 glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL); /* set the environment */ 10 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 11 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 12 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 13 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 14 15 /* load the actual texture into GL's memory */ 16 glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,ph.width,ph.height,0,GL_RGB,GL_UNSIGNED_BYTE,tex); 17 18 free(tex); /* we no longer need this memory lying around */ 19 glEnable(GL_TEXTURE_2D); /* tell gl to use the texture */ 20 21 ...