PDA

View Full Version : Texture Color Distortion at Angles



Snuffy
02-19-2012, 05:54 PM
Hello, this is my first post here and i am kind of new to opengl so i came here looking for some help. I really dont know what is causing this and it is rather annoying so maybe some one here might know what it is.

I have a simple opengl project that has some textures in it. The textures are rendered fine up close but from a distance at steep angles the color gets shifted to blue(the texture is originally mostly green) for some reason. The textures are just simple cubemaps with a MIN_FILTER of GL_NEAREST_MIPMAP_LINEAR and a MAG_FILTER of GL_NEAREST. It also doesn't seem to matter from what side i am looking at the texture from, the blue lines seem to always run in the x axis(see picture).

I really have no idea has how to fix this and my attempts to google it have failed so i have come to you for help, thanks in advance.

Pic attached depicting what i mean.

Alfonse Reinheart
02-19-2012, 08:53 PM
Where do the mipmaps come from? If you're loading them from disk, have you taken them into an image editor and looked at them?

Snuffy
02-19-2012, 09:19 PM
I am fairly new so i am just using SOIL to load my textures and generate the mipmaps, as i do not know how soil does it i can not tell you how they are being generated so maybe it could just be soil's fault.

On the same note, the odd effect does not appear when i don't use the mipmaps so it is looking to be some how a side effect of the mipmaps.

Snuffy
02-20-2012, 12:48 AM
I am starting to really think its the mipmaps so i am trying to generate them with glGenerateMipmap and not with soil but i cant seem to get it to work properly. All it does is display white.

my texture loading code is this...


id = SOIL_load_OGL_single_cubemap(formatedBmpPath,"EWNSUD",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,0);

glBindTexture(GL_TEXTURE_CUBE_MAP, id);

glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN _FILTER,GL_NEAREST_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG _FILTER,GL_NEAREST);
glGenerateMipmap(id);

i really have no idea what i am doing wrong now... i just dont seem to be having any luck today...