I am testing alpha in glColor4f, but the result of using glColor4f(1.0, 1.0, 0, 0);
is same as using glColor4f(1.0, 1.0, 0, 1);
.
I've tried changing glClearColor(0.0, 0.0, 0.0, 0.0);
to glClearColor(0.0, 0.0, 0.0, 1.0);
,it changes nothing.
Here's my code:
#include <GL/glut.h>
void init();
void display();
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("OpenGL 3D View");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
void init()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(-5, 5, -5, 5, 5, 15);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor4f(1.0, 1.0, 0, 0.01);
glutWireTeapot(3);
glFlush();
}
I am wondering how did the transparency works. Thank you~