Click here to Skip to main content
13,252,206 members (56,448 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I display an image as background for my game.
Now if I display any image or polygon etc its colour is different from what I specified, how to get rid of this problem?
Posted 1-Oct-11 10:21am
Updated 3-Oct-11 9:28am
Santhosh_G 2-Oct-11 0:07am
How you are displaying image? Texture mappping may cause such isues.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please check blending is enabled before drawing polygon.
Blending will create an intermediate color of previous image available in framebuffer(background image) and current image.

Please call glDisable( GL_BLEND ) before rendering your polygon and other images.

In texture mapping another tricky thing exists, if you are not specified the texture environment properly, it will consider GL_MODULATE texture environment. The default texture environment is GL_MODULATE, which multiplies the texture color by the primitive (or lighting) color.

For example you are not changed texture environment, and changed color using glColor.

glColor3f( 1.0, 0.0, 0.0 );

// texture mapping code.
// this texture mapping outputs red color and ignores green, and blue channels.

This problem can be solved by providing proper texture environment parameter.

Your problem is not much clear in the question, please provide more information to solve your problem.
Sweety Khan 4-Oct-11 10:43am
dont know wht was the reason of problem but the problem is solved when i make the fn of tht code n just call it where it is required. btw thanx for telling me about GL_BLEND and GL_MODULATE :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 3 Oct 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100