Original Post
I have a problem with blending in opengl.. This is my code. THe problem is the object blend nothing and result with 1 rectangle and another rectangle behind but it cant see both of it. I do enable blend and put blendfunc(); and stuff. But Still not working. Anyideas to fix it? My code void glRect(GLfloat width,GLfloat height) { glBegin(GL_QUADS); glVertex3f((width) / 2,height / 2,0); glVertex3f(-(width) / 2,(height / 2),0); glVertex3f(-(width) / 2,-(height / 2),0); glVertex3f((width) / 2,-(height / 2),0); glEnd(); } void Display() { glClearColor (0.0f, 0.0f, 0.0f, 0.0f); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(52.0f,256/256,1,1000); glViewport(0,0,256,256); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-5); glPushMatrix (); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glColor4f(0,0,1,0.5); glTranslatef(0,0,0.3); glRect(2,2); glTranslatef(0,0,-0.3); glColor4f(1,0,0,1); glRect(1,3); glPopMatrix (); }