OpenGL:MipMap

OpenGL:MipMap
imageData = readImage();
 
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, g_envMode);
// GL_DECAL, GL_BLEND , GL_MODULATE
decal是直接画上去覆盖原来的颜色值
blend为 r = src.r * (1-alpha) + dis.r * alpha
modulate为 r = src.r * dis.r
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 512, 512, GL_RGB, GL_FLOAT, imageData);

delete[](imageData);
imageData = NULL;

你可能感兴趣的:(OpenGL:MipMap)