Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

graphics-03

graphics-03 


#include<GL/gl.h>

#include<Gl/glu.h>

#include<GL/glut.h>

#include<stdlib.h>

#include<string>

#include<math.h>


void display(void)

{

    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0.298,0.616,0.3137);

    glLineWidth(4);

    glBegin(GL_LINES);

    glVertex3f(30,60,0);

    glVertex3f(50,80,0);

    glColor3f(0,0,1);

    glBegin(GL_LINES);

    glVertex3f(50,80,0);

    glVertex3f(70,60,0);

    glColor3f(0,1,1);

    glBegin(GL_LINES);

    glVertex3f(30,60,0);

    glVertex3f(70,60,0);

    glColor3f(1,1,0);

    glBegin(GL_LINES);

    glVertex3f(30,60,0);

    glVertex3f(30,20,0);

    glColor3f(1,1,1);

    glBegin(GL_LINES);

    glVertex3f(30,20,0);

    glVertex3f(70,20,0);

    glColor3f(1,0,1);

    glBegin(GL_LINES);

    glVertex3f(70,60,0);

    glVertex3f(70,20,0);

    glColor3f(0,1,1);

    glBegin(GL_LINES);

    glVertex3f(45,20,0);

    glVertex3f(45,40,0);

    glColor3f(1,1,1);

    glBegin(GL_LINES);

    glVertex3f(55,20,0);

    glVertex3f(55,40,0);

    glColor3f(0,1,1);

    glBegin(GL_LINES);

    glVertex3f(45,40,0);

    glVertex3f(55,40,0);



    glEnd();


    glColor3f(0.18,0.916,0.17);

    glBegin(GL_POLYGON);

    glVertex3f(30,60,0);

    glVertex3f(50,80,0);

    glVertex3f(70,60,0);

    glEnd();


    glColor3f(0,0,0);

    glBegin(GL_POLYGON);

    glVertex3f(30,60,0);

    glVertex3f(70,60,0);

    glVertex3f(30,20,0);

    glVertex3f(70,20,0);

    glVertex3f(70,60,0);

    glEnd();


    glColor3f(1,0,1);

    glBegin(GL_POLYGON);

    glVertex3f(45,20,0);

    glVertex3f(45,40,0);

    glVertex3f(55,20,0);

    glVertex3f(55,40,0);

    glVertex3f(45,40,0);

    glVertex3f(55,40,0);

    glEnd();


    glutSwapBuffers();


}

void init(void)

{

    glClearColor(0.23,0.8,0.95,0.0);

    glMatrixMode(GL_PROJECTION);

    glLoadIdentity();

    glOrtho(0.0,100.0,0.0,100.0,-1.0,1.0);

}

int main(int argc,char** argv)

{

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);

glutInitWindowSize(1000,600);

glutInitWindowPosition(50,10);

glutCreateWindow("Line and Triangle");

glutDisplayFunc(display);

init();

glutMainLoop();

return 0;

}


Post a Comment

0 Comments