PDA

View Full Version : glLogicOp()



taz2003
06-03-2003, 07:13 AM
Hi,
I've been trying to make glLogicOp() work but doesn't do anything (?)

First I enable the function with glEnable(GL_LOGIC_OP); I use shade model GL_FLAT, and I draw a triangle

glBegin(GL_TRIANGLES);
glColor4f(0.0, 0.0, 1.0, 1.0);//blue
glVertex3f(-0.4, 0.5, 0.0);
glVertex3f(-0.4, -0.3, 0.0);
glVertex3f(0.2, 0.1, 0.0);
glEnd();
glLogicOp(GL_CLEAR);
glFlush();

I am expecting to see a triangle with different color, but I still see the same blue triangle. I tried with two triangles with an intersecting region and enabled blending and nothing happened either. Is there another function that should be used or enabled in conjunction with glLogicOP?

Relic
06-03-2003, 07:23 AM
Set it before(!) you draw the triangle.
If you use an RGB pixelformat, use glEnable(GL_COLOR_LOGIC_OP). GL_LOGIC_OP is the same as GL_INDEX_LOGIC_OP which won't work in RGB mode.
GL_COPY is the default.

taz2003
06-03-2003, 09:01 AM
Relic, you don't know how much I appreciate your help. I just tried it and works!! Yes my problem was that I was in RGB mode. Again thanks!