#include<windows.h>--- Content provided by FirstRanker.com ---
#include<GL/glut.h>
float xm,ym,xmm,ymm;
void display()
{
}--- Content provided by FirstRanker.com ---
/* Program to draw erasable rectangle */
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_COLOR_LOGIC_OP);--- Content provided by FirstRanker.com ---
void myMouse(int btn, int state, int x, int y)
{
if(btn==GLUT_LEFT_BUTTON && state==GLUT_DOWN)
{
xm=x;--- Content provided by FirstRanker.com ---
ym=(500-y);
glColor3f(0.0,0.0,1.0);
glLogicOp(GL_XOR);
}
if(btn==GLUT_LEFT_BUTTON && state==GLUT_UP)--- Content provided by FirstRanker.com ---
{
xmm=x;
ymm=(500-y);
glLogicOp(GL_XOR);
glRectf(xm,ym,xmm,ymm);--- Content provided by FirstRanker.com ---
glFlush();
}
}
void reshape(GLsizei w, GLsizei h)
{--- Content provided by FirstRanker.com ---
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,500,0,500);
glMatrixMode(GL_MODELVIEW);--- Content provided by FirstRanker.com ---
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_DEPTH|GLUT_RGB);
glutInitWindowSize(500,500);--- Content provided by FirstRanker.com ---
glutInitWindowPosition(100,100);
glutCreateWindow("erasable lines");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(myMouse);--- Content provided by FirstRanker.com ---
glutMainLoop();
}
--- Content provided by FirstRanker.com ---
This download link is referred from the post: AKTU B-Tech Last 10 Years 2010-2020 Previous Question Papers || Dr. A.P.J. Abdul Kalam Technical University