所以我現在加載了我的圖像,但它說你可以爲MipMap生成一個標誌 。我設置了標誌,據我所知,在某些時候使用MipMaps時,OpenGL會做 休息。OpenGL Mipmap和土壤標誌
我錯了嗎?如果我是,我如何讓MipMaps工作?
編輯:所以這是我的初始化函數,其中我打電話土壤與FLAG載入我的圖像的貼圖
//========================================
// init
//========================================
void init(void) {
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
glEnable (GL_BLEND); //transparency
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
timerSpeed = 1000.0/60.0;
for(int i=0; i<6; i++) {
TextureNames[i] = TextureNames[i]+".bmp";
TextureArray[i] = SOIL_load_OGL_texture((char*)TextureNames[i].c_str(),3,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_POWER_OF_TWO |
SOIL_FLAG_MIPMAPS);
}
}
而這正是我打電話bindtexture和texparam(剪短,因爲它只是另 面立方體,popmatrix和結束}爲函數
void drawCube(void) {
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, TextureArray[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//FRONT FACE OF CUBE
glNormal3f(0.0,0.0,1.0);
glBegin(GL_POLYGON);
glTexCoord2f(0.0,0.0); glVertex3f(-1.0,-1.0,1.0);
glTexCoord2f(1.0,0.0); glVertex3f(1.0,-1.0,1.0);
glTexCoord2f(1.0,1.0); glVertex3f(1.0,1.0,1.0);
glTexCoord2f(0.0,1.0); glVertex3f(-1.0,1.0,1.0);
glEnd();
//LEFT FACE OF CUBE
glNormal3f(-1.0,0.0,0.0);
glBegin(GL_POLYGON);
glTexCoord2f(0.0,0.0); glVertex3f(-1.0,-1.0,-1.0);
glTexCoord2f(1.0,0.0); glVertex3f(-1.0,-1.0,1.0);
glTexCoord2f(1.0,1.0); glVertex3f(-1.0,1.0,1.0);
glTexCoord2f(0.0,1.0); glVertex3f(-1.0,1.0,-1.0);
glEnd();
爲什麼要傳遞3而不是SOIL_LOAD_RGB? – 2011-04-26 05:11:04
嗨,對於遲到的響應RTS感到抱歉,自從我搞亂這個以來已經有一段時間了,但是如果我記得正確地將一個數字放在一起,就像調用SOIL_LOAD_RGB一樣。我可能是錯的,但我認爲這是沿着這些線的東西! – 2011-05-27 17:51:11