/* jcorso::nb - gr_opengl_mip.c.html */ int texname; /* id for the texture we'll be using * the mipmap still only has one texture name... */ ... 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_MIPMAP_NEAREST); 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); /* use the glu call to generate the mipmaps for the texture */ gluBuild2DMipmaps(GL_TEXTURE_2D,3,width,height,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 */ ...