Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Strange Texture Color Problems

This topic is 5791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using opengl under sdl and am experiencing strange color problems when I texture map my polygons. Basically everything looks correct the texture map is scaled properly etc, except for the color values for the pixels are a few units higher or lower then the original image. (determined from photoshop) I've checked the values in the raw pixel data also and they are the appropriate values, it is only when it is displayed it is slightly off. The texture map is 16x16 and this is in orthogonal mode. Here is the basic code:
glGenTextures(1, &Textures[framenum]);
glBindTexture(GL_TEXTURE_2D, Textures[framenum]);   glTexParameter(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); 
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, temppixels);

glColor3f(1.0f, 1.0f, 1.0f);
xleft = 100;
xright = 116;
ytop = 100;
ybottom = 116;
glTexCoord2f(0.0f,0.0f); glVertex2i(xleft, ytop); //top left

glTexCoord2f(0.0f,1.0f); glVertex2i(xleft, ybottom); //bottom left

glTexCoord2f(1.0f,1.0f); glVertex2i(xright, ybottom); //bottom right

glTexCoord2f(1.0f,0.0f); glVertex2i(xright, ytop); //top right

Any help is much appreciated. Thanks! Grunhund [edited by - Grunhund3 on February 2, 2003 6:09:23 PM] [edited by - Grunhund3 on February 2, 2003 6:10:28 PM]

Share this post

Link to post
Share on other sites
I''ll answer the question in case the search button starts working at some future date.

Apparently for the glTexImage2D() internal format parameter, GL_RBGA does not default to 8 bits. Changing this to GL_RBGA8 fixed the problem.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!