Hi, I need fast image processing in my application. I find example of code on some site:
static void brightness(V2fT2f *quad, float t) // t [0..2]
{
// One pass using one unit:
// brightness < 1.0 biases towards black
// brightness > 1.0 biases towards white
//
// Note: this additive definition of brightness is
// different than what matrix-based adjustment produces,
// where the brightness factor is a scalar multiply.
//
// A +/-1 bias will produce the full range from black to white,
// whereas the scalar multiply can never reach full white.
glVertexPointer (2, GL_FLOAT, sizeof(V2fT2f), &quad[0].x);
glTexCoordPointer(2, GL_FLOAT, sizeof(V2fT2f), &quad[0].s);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
if (t > 1.0f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glColor4f(t-1, t-1, t-1, t-1);
}
else
{
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT);
glColor4f(1-t, 1-t, 1-t, 1-t);
}
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
validateTexEnv();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
i tried to use this code in my app,
but the result for t>1 was absolutely white image and black for t<1. I tried many variations of code changes, but still hadn’t anyone differed from white or black color. What may be the problem? Could anyone help me?