#include
#include
?oat xm,ym,xmm,ymm;
void display()
--- Content provided by FirstRanker.com ---
{glClearColor(1.0,1.0,1.0,1.0);
g1Clear(GL_COLOR_BUFFER_BIT);
glEnable(GL_COLOR_LOGIC_OP);
void myMouse(int btn, int state, int x, int y)
--- Content provided by FirstRanker.com ---
if(btn==GLUT_LEFT_BUTTON && state==GLUT_DOWN){
xm=x;
ym=(500-y);
glColor3f(0.0,0.0,1.0);
--- Content provided by FirstRanker.com ---
glLogicOp(GL_XOR);}
if(btn==GLUT_LEFT_BUTTON && state==GLUT_UP)
{
xmm=x;
--- Content provided by FirstRanker.com ---
ymm=(500-y);glLogicOp(GL_XOR);
glRectf(xm,ym,xmm,ymm);
glFlushO;
}
--- Content provided by FirstRanker.com ---
void reshape(GLsizei w, GLsizei h){
glMatrixMode(GL_PROJECTION);
glLoadIdentityO;
gluOrth02D(0,500,O,500);
--- Content provided by FirstRanker.com ---
g1MatrixMode(GL_MODELVIEW);}
int main(int argc, char **argV)
{
glutInit(&argc, argv);
--- Content provided by FirstRanker.com ---
g1utInitDisplayMode(GLUT_SINGLE| GLUT_DEPTH|GLUT_RGB);glutlnitWindowS ize(500,5 00);
g1utInitWindowPosition(100,100);
glutCreateWindow(?erasable lines?);
g1utDisplayFunc(display);
--- Content provided by FirstRanker.com ---
glutReshapeFunc(reshape);glutMouseFunc(myMouse);
glutMainLoopO;
/* Program to draw erasable |ines*/
--- Content provided by FirstRanker.com ---
#include#include
?oat xm,ym,xmm,ymm;
void displayO
}
--- Content provided by FirstRanker.com ---
glClearColor(1.0,1.0,1.0,1.0);glClear(GL_COLOR_BUFFER_BIT);
g1Enable(GL_COLOR_LOGIC_OP)',
void myMouse(int btn, int state, int x, int y)
if(btn==GLUT_LEFT_BUTTON && state==GLUT_DOWN)
--- Content provided by FirstRanker.com ---
{xm=x;
ym=(500-y);
glColor3f(0.0,0.0,1.0);
glLogicOp(GL_XOR);
--- Content provided by FirstRanker.com ---
}if(btn==GLUT_LEFT_BUTTON && state==GLUT_UP)
{
glColor3f(0.0,1.0,0.0);
xmrn=x;
--- Content provided by FirstRanker.com ---
ymm=(500-y);glLogicOp(GL_XOR);
ngegin(GL_LINES);
glVertex2f(xm,ym);
glVertex2f(xmm,ymm);
--- Content provided by FirstRanker.com ---
glEndo;glFlushO;
}
}
void reshape(GLsizei w, GLsizei h)
--- Content provided by FirstRanker.com ---
{}
g1MatriXMode(GL_PROJECTION);
glLoadIdentityO;
gluOrtho2D(O,500,0,500);
--- Content provided by FirstRanker.com ---
glMatriXMode(GL_MODELVIEW);int main(int argc, char **argV)
{
glutlnit(&argc, argV);
glutlnitDisplayMode(GLUT_SINGLE|GLUT_DEPTH|GLUT_RGB);
--- Content provided by FirstRanker.com ---
glutInitWindowSize(500,500);glutlnitWindowPosition(100, 100);
glutCreateWindow("erasable lines");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
--- Content provided by FirstRanker.com ---
glutMouseFunc(myMouse);glutMainLoopO;
/* Program on Mouse motion event */
#include
--- Content provided by FirstRanker.com ---
#include?oat xm,ym,xmm,ymm;
int first=0;
void display()
{
--- Content provided by FirstRanker.com ---
glClearColor(1.0,1.0,1.0,1.0);g1Clear(GL_COLOR_BUFFER_BIT);
g1Enable(GL_COLOR_LOGIC_OP);
void myMouse(int btn, int state, int x, int y)
if(btn==GLUT_LEFT_BUTTON && state==GLUT_DOWN)
--- Content provided by FirstRanker.com ---
{xm=x;
ym=(500-y);
glColor3f(0.0,1.0,1.0);
glLogicOp(GL_XOR);
--- Content provided by FirstRanker.com ---
first=1;}
}
void Move(int x, int y)
if(first= 1)
--- Content provided by FirstRanker.com ---
{xmm=x;
ymm=500-y;
ngegin(GL_LINES);
glVertex2f(xm,ym);
--- Content provided by FirstRanker.com ---
glVertex2f(xmm,ymm);glEndO;
glFlushO;
}
}
--- Content provided by FirstRanker.com ---
void reshape(GLsizei w, GLsizei h){
glMatrixMode(GL_PROJECTION);
glLoadIdentityO;
gluOrth02D(0,500,O,500);
--- Content provided by FirstRanker.com ---
g1MatrixMode(GL_MODELVIEW);}
int main(int argc, char **argV)
{
glutInit(&argc, argv);
--- Content provided by FirstRanker.com ---
g1utInitDisplayMode(GLUT_SINGLE|GLUT_DEPTH|GLUT_RGB);glutInitWindowSize(500,500);
g1utInitWindowPosition(100,100);
glutCreateWindow("erasable lines?);
g1utDisplayFunc(display);
--- Content provided by FirstRanker.com ---
glutReshapeFunc(reshape);glutMouseFunc(myMouse);
glutMotionFunc(Move);
glutMainLoopO;