texture combine with masking:

Hi everyone:
I am new to OpenGL and hope you guys can help me.

I have a texture and I used the following code to interpolate the texture with white color to make the texture “whitish”. But what I really want to do is to blend just the central 50x50 pixels but not the whole texture. How can I do this? Is there a “masking” concept in OpenGL?

Thank you very much.

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 1);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);   //Interpolate RGB with RGB
glColor4f(1, 1, 1, 1);

glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR);
//GL_CONSTANT refers to the call we make with glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, mycolor)
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
//------------------------
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);   //Interpolate ALPHA with ALPHA
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
//------------------------

t = 0.5
float mycolor[4];
mycolor[0]=mycolor[1]=mycolor[2]=t; //RGB doesn’t matter since we are not using it
mycolor[3]=t; //Set the blend factor with this
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, mycolor);

Any reason why you aren’t using shaders?

I have no idea how to use it. Can you post some code?

Thank you very much,

fireman