Click here to Skip to main content
11,813,974 members (46,039 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ OpenGL
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 9:21am
Edited 3-Oct-11 8:28am
Santhosh_G at 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 at 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
0 Abhinav S 265
1 Maciej Los 203
2 Palash Mondal_ 190
3 Sergey Alexandrovich Kryukov 179
0 OriginalGriff 3,877
1 KrunalRohit 2,526
2 Maciej Los 2,245
3 CPallini 2,240
4 ppolymorphe 1,750

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 3 Oct 2011
Copyright © CodeProject, 1999-2015
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