Sign in to follow this  

OpenGL texture mapping - color problem

Recommended Posts

HI, I'm doing some texture mapping and it's working. My problem is with the colors. I also have problems with .jpg, nothing comes out. I'm using devil as image library and my code to load textures its the following: void LoadAllTextures(void) { ILubyte *imageData; ILuint image,w,h; ilInit(); iluInit(); ilutRenderer(ILUT_OPENGL); ilEnable (IL_CONV_PAL); ilutEnable (ILUT_OPENGL_CONV); ilGenImages(1,&image); ilBindImage(image); ilLoadImage("splash.bmp"); w = ilGetInteger(IL_IMAGE_WIDTH); h = ilGetInteger(IL_IMAGE_HEIGHT); imageData = ilGetData(); glNewList(actualImage = glGenLists(1), GL_COMPILE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glTexImage2D(GL_TEXTURE_2D, 0, 4, w,h, 0, GL_RGB, GL_UNSIGNED_BYTE,imageData); glEndList(); } One image has blue tones and they become orange in the mapped texture. Other one is orange and becomes blue. This ones are the bmp's, because if i use a .jpg it doesnt give a thing. What am i doing wrong? Many thx, Best regards, Nuno Santos

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this