Reputation: 289
I need to render an object using an existing texture, and I need to alter the color during the rendering. (Such as multiplying red channel by 0.5.) The existing texture is not monochromatic. I need to do this without enabling lighting and without shaders so I don't disturb the application I'm working within. I cannot work early enough in the rendering that I could read/write the buffer directly.
In effect, I'd like some sort of color-transformation matrix or filter that works during normal rendering.
Upvotes: 0
Views: 306
Reputation: 35
OpenGL has a color transformation matrix (GL_COLOR) that can be accessed and modified just like GL_MODELVIEW or GL_PROJECTION (you will most probably need glLoadMatrix or glMultMatrix, as glRotate and such doesn't make much sense with colors). It requires the extension GL_ARB_imaging.
Upvotes: 0
Reputation: 1423
Base in the limited information I'll assume some things.
I'll assume you are working with fixed pipeline. I'll assume you are not using a low level pixel function like glBitmap or glDrawPixels. If you are you should not.
To solve you problem try the following: Draw a textured quad, using glBegin,glEnd,glVertex2f,glTexCoord2f To alter the color use glColor just after glBegin and before any other draw instruction. You should do your color-transformation matrix in the cpu and use that result with glColor.
Image will be blended accordingly. WHITE doesn't change the image color. Make sure GL_LIGHTING is not enabled.
Upvotes: 1