I'm trying to load a PNG texture in OpenGL using the SOIL libray, and show the texture in GL QUAD, but when I call the function, the image is loaded correctly, but change the color of entire screen!
if a blue image, the screen changes to blue pigment! if red, changes to red! Anyone know what is causing this
Right colours without image loaded: http://i.stack.imgur.com/OHroq.jpg
Wrong colours with image loaded: http://i.stack.imgur.com/LyRwJ.jpg
CODE:
int LoadGLTextures() {
texture[0] = SOIL_load_OGL_texture("test.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);}
and the square code:
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(mover, 11.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( mover+44,11.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(mover+44, 44.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(mover, 44.0f, 1.0f);
glEnd();
}