Hello. I am trying to make a fadein effect, but unfortunately the screen becomes black too fast…
enable2D();
float alpha = 1.0f;
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Enable Blending (disable alpha testing)
//glEnable(GL_BLEND);
while (alpha>0) {
glBegin(GL_QUADS);
glColor4f(1.0f, 1.0f, 1.0f, alpha);
alpha -= 0.005f;
//glTexCoord2f(0,1);
glVertex2d(0,0);
//glTexCoord2f(0,0);
glVertex2d(1024,0);
//glTexCoord2f(1,0);
glVertex2d(1024,768);
//glTexCoord2f(1,1);
glVertex2d(0,768);
glEnd();
glfwSwapBuffers();
}
//glDisable(GL_BLEND);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
disable2D();