Hi,
in my project i load a bitmap image and then i put it into a texture using glTexImage2D. After i do this, when i draw something e.x a circle, i use black color it is black, if i try any other color the results are not what they should be. For example if i draw white the output color is dark red (that depends on the colors of the image). This seems unreasonable but maybe you know something i dont.
when the image has only black and white colors i have no problem. The problem occures when i load a coloured image.
The code i use to load the image is not mine, i found it ready but i dont think its the problem cause i tried other codes with the same result.
with this code i make it a texture
ImageLoad(“bitmap.bmp”, in_image);
glGenTextures(1, &texture[2]);
glBindTexture(GL_TEXTURE_2D, texture[2]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, 4, in_image->sizeX, in_image->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, in_image->data);
free(in_image->data);
free(in_image);
So if i try to draw a white rectangle like this
glBegin(GL_QUADS);
glColor3f(1.0f,1.0f,1.0f);
glVertex3f(0.0f,size_winy,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(size_winx,0.0f,0.0f);
glVertex3f(size_winx,size_winy,0.0f);
glEnd();
some other color is drawn(depending on the image).
If you can help me understand why is that and fix it, i’ll be very gratefull.
Thanx