I met a problem in makeing a simple 2d graphic engine with opengl.
That is:
I need to render a bitmap with a brightness property. It means, the brightness of the bitmap may be changed at any time while the programme running.
So, i try to draw a white blend rectangle on the same place with the bitmap to achieve my goal.
I wrote down something like this:
glBegin(GL_QUAD);
//part1 , x,y,z means some float numbers.
glTexCoord2f(x,y);glVertex3f( left , top , 0 );
glTexCoord2f(x,y);glVertex3f( left , bottom , 0 );
glTexCoord2f(x,y);glVertex3f( right , bottom , 0 );
glTexCoord2f(x,y);glVertex3f( right , top , 0 );
//part 2 : draw a white rectangle
glColor4f(1.0f , 1.0f , 1.0f , blend);
glVertex3f( left , top , 0 );
glVertex3f( left , bottom , 0 );
glVertex3f( right , bottom , 0 );
glVertex3f( right , top , 0 );
glEnd();
Obviously, it failed. Becuause in part 2, 4 vertexs has been texture mapped same as the last vertex in part 1.
Here is the question, how can i remove the texture binding or mapping?
I’ve seeken a way out, that is disable GL_TEXUTRE_2d before part2 , and enable it after draw the white rect. It works, but sounds stupid and low efficient.
So, any one can give me some other advices ?