#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/glut.h>
/**
* glRectf( x1, y1, x2, y2 )
*/
void setup(){
glClearColor(1.0, 1.0, 1.0, 1.0);
gluOrtho2D(-01.0, 10.0, -01.01, 10.0);
}
void setup(){
glClearColor(1.0, 1.0, 1.0, 1.0);
gluOrtho2D(-01.0, 10.0, -01.01, 10.0);
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 1.1);
glPointSize(2.0);
// x1, x2, y1, y2
glRectf(1.0, 1.0, 5.0, 5.0);
glBegin(GL_LINES);
glRectf(1.0, 1.0, 5.0, 5.0);
glBegin(GL_LINES);
// glVertex2f( x, y )
// horizontal line
glVertex2f(-10.0, 0.0);
glVertex2f(10.0, 0.0);
glVertex2f(-10.0, 0.0);
glVertex2f(10.0, 0.0);
//vertical line
glVertex2f(0.0, 10.0);
glVertex2f(0.0, -10.0);
glEnd();
glFlush();
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 100);
glutInitWindowSize(400, 300);
glutCreateWindow("Hello World");
glutDisplayFunc(display);
setup();
glutMainLoop();
return 0;
}
glVertex2f(0.0, 10.0);
glVertex2f(0.0, -10.0);
glEnd();
glFlush();
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 100);
glutInitWindowSize(400, 300);
glutCreateWindow("Hello World");
glutDisplayFunc(display);
setup();
glutMainLoop();
return 0;
}
No comments:
Post a Comment