Color editing/blending of texture


I have a texture with a font on it with a brown colour. In GIMP you can put a layer over it with (for example) a blue colour and select layer properties on ‘colour’ and the image/font takes those colours. The algorithm has something to do with converting first to HSL/HSB, but perhaps that’s not needed. (Here is how GIMP does it:

How should I go about doing this in OpenGL. Is it possible? I read something about ARB_texture_env_combine (here:, is that a possibility?

Please some help. I have no idea where to start. :frowning:

As far as I can see from the GIMP sources, it has to be done in HSL domain. You can do it in a shader, that accepts 2 texture units and produces one output color.

Could you give a bit more info? Perhaps example code or where I can find example (tutorial) to work with shaders.

I’m using this OpenGL2 code for shaders, but when I call setShaders() in my program (which is opengl in windows form), the program crashes.

Compiling the program of that website works and I’m even able to run it as it is supposed, but putting the code into my program makes it crash.

It looks like the program crashes on these two:

v = glCreateShader(GL_VERTEX_SHADER);
f = glCreateShader(GL_FRAGMENT_SHADER);


Did you load the function properly?
If you are using an extension function or a core function of a version superior to openGL 1.1 you need to load id (with glew or another gl loader… or by hand, but it’s very boring).

Thanks for the help.

Apparently I only needed to add this little line: