View Full Version : How a textured quad lighter?

02-21-2004, 11:07 AM
Hi guys!

I've got the following problem: For our game, we use a '2d' ortho setup. Everything works fine. I'd like to be able to 'highlight' single objects on the screen when the mouse is right over them. Now I've experimented around and found, that

glColor3f( 0.75 , 0.75 , 0.75 )

will make things slightly darker. So I can use that by default for everything else and just use 1.0/1.0/1.0 for the highlighted object. However, that makes the scene quite dark overall and it gets a greyish look. Has someone some suggestion how this could be done more elegantly? I'd be very thankful if you could come up with some feasible solution...

Thanks a lot and see ya, jp.

02-22-2004, 11:30 PM
Strange, is there really no way to add 'light' to a texture during the blitting process in this whole OpenGL thing? Nobody got any clues? I know I posted this many month ago, but also then, no responses...

02-23-2004, 09:36 AM
How about glColor3f(1.25,1.25,1.25); ?

02-23-2004, 09:58 AM
- Draw your textured quad
- Enable blending
- Set src-factor and dst-factor to GL_ONE (=additive blending)
- Draw the quad again with a z-value nearer to your near-plane than your textured quad

That's how I would do it. Cheap and easy to implement.

02-23-2004, 11:13 PM
Thanks for the suggestions. The thing with the 1.25 seems not to do anything, but the other hint just works wonderfully. I didn't even have to care about the z-thing but it worked just by re-blitting with 'additional' mode. Wondeful! Great!

Thanks a lot and see ya, jp.