How do I perform an HSL transform on a texture?
        Posted  
        
            by Mason Wheeler
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Mason Wheeler
        
        
        
        Published on 2010-04-29T17:21:49Z
        Indexed on 
            2010/04/29
            17:27 UTC
        
        
        Read the original article
        Hit count: 552
        
If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look?
I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and saturation and lightness multipliers between 0 and 2, and then have it call a shader that will apply these transformations to the texture before it renders. The interface would look something like this:
procedure HSLTransform(texture: GLuint; hShift: integer; sMult, lMult: GLfloat);
I have no idea what's supposed to go inside the routine, though. I understand the basic math involved in HSL/RGB conversions, but I don't know how to write a shader or how to apply it. Can someone point me in the right direction? Delphi examples preferred, but I can also read C if I have to.
© Stack Overflow or respective owner