#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
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, 0.0);
// vector defining
GLfloat one[] = {0.5, 0.5};
GLfloat two[] = {0.5, 5.0};
GLfloat three[] = {5.0, 5.0};
glBegin(GL_POLYGON);
glVertex2fv(one);
glVertex2fv(two);
glVertex2fv(three);
glEnd();
glBegin(GL_LINES);
// horizontal lines
glVertex2f(-10.0, 0.0);
glVertex2f(10.0, 0.0);
// vertical lines
glVertex2f(0.0, -10.00);
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;
}
#include <GL/glu.h>
#include <GL/glut.h>
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, 0.0);
// vector defining
GLfloat one[] = {0.5, 0.5};
GLfloat two[] = {0.5, 5.0};
GLfloat three[] = {5.0, 5.0};
glBegin(GL_POLYGON);
glVertex2fv(one);
glVertex2fv(two);
glVertex2fv(three);
glEnd();
glBegin(GL_LINES);
// horizontal lines
glVertex2f(-10.0, 0.0);
glVertex2f(10.0, 0.0);
// vertical lines
glVertex2f(0.0, -10.00);
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