PDA

View Full Version : Dark Texture...



bishop
06-12-2002, 05:27 AM
Hi everyone,

I have a small problem with texture mapping. I am mapping a greyscale image on a plane but the texture appear very darker than it should be. I thought it could be a lighting problem but even with disabling it, the result is the same.

Here is some of the parameters that I used:

minfilter = GL_NEAREST;
magfilter = GL_NEAREST;
env = GL_DECAL;
wraps = GL_CLAMP;
wrapt = GL_CLAMP;

glBindTexture (GL_TEXTURE_2D, g_texture[index]);
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ) ;
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ) ;
glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 ) ;
glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 ) ;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wraps);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapt);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magfilter);


(...)

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
ImageWidth, ImageWidth,
0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
&image[0][0][0]);


Thank in advance!

bishop
06-12-2002, 06:04 AM
Oh I forgot, I used also
glTexEnvf(GL_TEXTURE_ENV ,GL_TEXTURE_ENV_MODE, env);
with
env to GL_REPLACE but the result is still the same...