[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GL_BLEND texturing mode.





I'm trying out using the GL_BLEND to draw UI components on a GL window.

The alpha side of things is working (bar what looks like a numerical
error on the hardware version, solved by using an alpha function to
ditch low alpha pixels)

However, the colour compoents come out inverted if I set the fragment
to be white {which makes sense - it does Cf(1-Ct) }. So, I set the
fragment colour to be black, set the texture environment colour to be
white and... all the colours come out to be black.

It's as if the CcCt part is always zero..

      glgenericrenderstate<true,false,true,GL_ALWAYS,GL_BLEND> pp7(0);
      pp7.set();

// this sets depthtest to true,
// depth mask to false
// blend to true,
// depthfunction to GL_ALWAYS
// texture mode to GL_BLEND

      float envcol[4]={ 1.0, 1.0, 1.0, 0.0 };
      glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR,envcol);
      glColor4f(0.0,0.0,0.0,1.0);

      glBegin(GL_TRIANGLES);     

This draws all the non TSP elements of the texture as black pixels...

It does the same thing on VoodooII and software rendeering, so I'm
figuring its something I've forgetten to setup.. Anyone any ideas?