PDA

View Full Version : help! openGL header > 1.1?



05-08-2004, 05:12 PM
I can't find a clear explanation, is there really no standard after 1.1? There are inconsistencies between the red book 1.2 and my 1.1 header file.

My issue right now is with mipmaping, the sample code provided doesn't seem to work. My code:

glGenTextures(1, &text_mud);

glBindTexture(GL_TEXTURE_2D, text_mud);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512,
512, 0, GL_RGBA, GL_UNSIGNED_BYTE, BMP512);

glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 128,
128, 0, GL_RGBA, GL_UNSIGNED_BYTE, BMP128);

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 40);

The above texture init does not render the texture unless I set GL_TEXTURE_MIN_FILTER to GL_NEAREST instead of GL_NEAREST_MIPMAP_NEAREST.

The last line does not compile because GL_TEXTURE_MAX_LOD is undefined in 1.1.

chowe6685
05-08-2004, 05:33 PM
to get functions/constants outside of 1.1, download glext.h. You still need to load the extensions with wglGetProcAddress or some similar function. As for you mipmap problem: you must define all levels of the mipmap for it to work. In your case you need 512x512, 256x256, 128x128 all the way down.

05-08-2004, 08:00 PM
Thanks! Going down to 1 pixel seems excessive but mipmapping works now... looks good too.

ZbuffeR
05-09-2004, 03:29 AM
Use glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); to auto generate the mipmaps using the card hardware. See the doc : http://oss.sgi.com/projects/ogl-sample/registry/SGIS/generate_mipmap.txt

Dave Astle
05-10-2004, 09:31 AM
You may find this article useful: link (http://www.gamedev.net/reference/programming/features/oglext/)