View Full Version : Converting RGBA values.
12-05-2007, 02:23 PM
I am a little new to OpenGL programming so go easy on me :) I read an article containing advanced programming techniques, in which was covered changing RGBA color values into Hue, Saturation, and Luminosity. I read somewhere that it was only supported by Silicone Graphics... Is there some other way to do this, or maybe someone could just point me into the right direction. My whole intent was to gradually change the hue and saturation of a rotating object in one of my projects and I just found it was really hard to do with just incrementing and decrementing the values in glColor4f based on rotation of the object. I'd appreciate any help with this! :)
12-05-2007, 03:51 PM
First, that was "Silicon Graphics" ... we are not talking about breast implants here :)
Then, please name your sources. "I read an article" or "I read somewhere" do not count.
Last, just search the web for "rgb to hsl" and implement this :
- convert original rgb color to hsl
- tweak hsl values
- convert new hsl back to rgb
You should have enough info now, good luck.
I tried a lot to be gentle :D
12-05-2007, 05:55 PM
Could have been worse(So I appreciate your leniency), and yes - that was a bad mistype on my part. I have not really done much with manipulating color other than RGBA values so I was unaware of that acronym HSL or HSV. I found this website after posting my question:
which explained alot with a sample algorithm C++ for converting back and forth from HSV/HSL and RGB
You also were right about not referencing what "I read...". Though I was speaking of this:
13.2.4 The Color Matrix Extension.
But thanks for replying and helping ZbuffeR ^_^.
12-06-2007, 06:02 AM
In fact this color matrix extension seem to be widely supported in ATI hardware, but not nvidia, according to this list :
Anyway, it does look a bit suspicious.
It looks better to do it by hand, either on the CPU and glColor, or with a fragment shader sampling from a texture for more advanced and realtime stuff.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.