Hello everyone..
Im trying to draw erasable lines using the XOR method..
ie draw a line in XOR mode, you get a line, then XOR it, it disappears..
But im facing the problem of generation of new colors!! since im XORing, the disppaearing of the old lines is happening, but the new line is of a different color..Is there any way i could solve this?? Heres the code:
void MouseMove(int x,int y)
{
if(FLAG == 0){
X = x;
Y = winh - y;
Xn = x;
Yn = winh - y;
FLAG = 1;
}
else if(FLAG == 1){
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
glBegin(GL_LINES);
glVertex2i(X,Y);
glVertex2i(Xn,Yn);
glEnd();
glFlush();/*Old line erased*/
glBegin(GL_LINES);
glVertex2i(X,Y);
glVertex2i(x, winh - y);
glEnd();
glFlush();
Xn = x;
Yn = winh - y;
}
}
This is my mouse motion callback..Now if the screen is colored to white and if i choose my current drawing color as RED, i get a bluish color due to the XORing..How to overcome this??



