title: How do I apply a colour transformation matrix to a texture in OpenGL
body: <p>Basically, I've got a colour matrix defined as such:</p>
  
  <pre><code>struct ColourXForm
  {
     float4 mul;
     float4 add;
  
     float4 Transform(float4 colour)
     {
        return float4(
           colour.x * mul.x + add.x,
           colour.y * mul.y + add.y,
           colour.z * mul.z + add.z,
           colour.w * mul.w + add.w);
     }
  }</code></pre>
  
  <p>What I want to do is to apply the function 'Transform' to each pixel in the texture as it is rendered onto the screen. I can't actually modify the texture as different colour transform matrices can be applied to the same image multiple times in a frame (and I don't know what will be applied until it is time to render the texture), and I can't use shaders either.</p>
  
  <p>Is there a way this could be done given these requirements? (my only idea so far is multi-texturing, but can't figure out how to apply it)</p>
  
  <p>Also, I'm new to OpenGL, so it would be helpful to post some code as well, or point me to a tutorial or even the required functions/parameters.</p>
  
  <p>Thanks</p>
  
  <p>Edit: One more thing I should mention, is that the texture contains pre-multiplied alpha, so blending is setup as <code>glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);</code></p>