PDA

View Full Version : I dont get it (fade-in/fade-out)



GL_ZERO
08-16-2003, 10:35 PM
I wana do a movie effect, i have read a topic here but i doesnt work.

CODE:
================================================
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
(*glActiveTextureARB)(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, texture[6]);

glBlendFunc(GL_ONE,GL_ONE);

glColor4f(1.0f,1.0f, 1.0f,blend);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f); glVertex2f(0, 0);
glTexCoord2f(0.0f, 0.0f); glVertex2f(0, glnHeight);
glTexCoord2f(1.0f, 0.0f); glVertex2f(glnWidth, glnHeight);
glTexCoord2f(1.0f, 1.0f); glVertex2f(glnWidth, 0);
glEnd();
glDisable(GL_BLEND);

==============================================

i see a semi transparent white quad, i cant see my logo. blend goes from 0 to 1 and than back to 0.(black-mylogo-black) this is what i want.

GL_ZERO
08-16-2003, 11:06 PM
Maybe some sample code/source code will help.

GL_ZERO
08-16-2003, 11:26 PM
nvm i fixed it, was my bad http://www.opengl.org/discussion_boards/ubb/biggrin.gif

dorbie
08-17-2003, 04:17 PM
Yup, the second glBlendFunc shouldn't have been there right.

GL_ZERO
08-18-2003, 09:01 AM
yep i replaced the 2nd blendfuction with the 1st one and i also forgot to enable textures lol

New working code, of some one needs it http://www.opengl.org/discussion_boards/ubb/smile.gif

================================================

glEnable(GL_BLEND);

(*glActiveTextureARB)(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, texture[6]);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(2.0f,2.0f, 2.0f, blend);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f); glVertex2f(0, 0);
glTexCoord2f(0.0f, 0.0f); glVertex2f(0, glnHeight);
glTexCoord2f(1.0f, 0.0f); glVertex2f(glnWidth, glnHeight);
glTexCoord2f(1.0f, 1.0f); glVertex2f(glnWidth, 0);
glEnd();
glDisable(GL_BLEND);

==============================================

[This message has been edited by GL_ZERO (edited 08-18-2003).]