Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Robot In OpenGL Using Line Function
1. Make Robot Using Line Function In OpenGL
#include "stdafx.h"
// Run by Visual C++ 6 with OpenGL
#include <GL/glut.h>
void init (void)
{
/* select clearing (background) color */
glClearColor (0.0, 0.0, 0.0, 0.0);
// (red, green, blue, alpha), used by glClear
/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
// (left, right, bottom, top, near, far)
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
2. //head
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.33, 0.75);
glVertex2f (0.18, 0.75);
glVertex2f (0.18, 0.55);
glVertex2f (0.33, 0.55);
glVertex2f (0.18, 0.75);
glVertex2f (0.18, 0.55);
glVertex2f (0.33, 0.75);
glVertex2f (0.33, 0.55);
glEnd();
//neck
glColor3f (1.0, 1.0, 1.0);
3. glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.28, 0.55);
glVertex2f (0.23, 0.55);
glVertex2f (0.23, 0.40);
glVertex2f (0.28, 0.40);
glVertex2f (0.23, 0.55);
glVertex2f (0.23, 0.40);
glVertex2f (0.28, 0.55);
glVertex2f (0.28, 0.40);
glEnd();
//body
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.40, 0.40);
glVertex2f (0.10, 0.40);
glVertex2f (0.10, -0.10);
glVertex2f (0.40, -0.10);
4. glVertex2f (0.10, 0.40);
glVertex2f (0.10, -0.10);
glVertex2f (0.40, 0.40);
glVertex2f (0.40, -0.10);
glEnd();
//right hand
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.48, 0.20);
glVertex2f (0.40, 0.40);
glVertex2f (0.40, 0.28);
glVertex2f (0.48, 0.10);
glVertex2f (0.48, 0.20);
glVertex2f (0.48, 0.10);
glEnd();
5. //left hand
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (-0.00, 0.20);
glVertex2f (0.10, 0.40);
glVertex2f (0.10, 0.28);
glVertex2f (-0.00, 0.10);
glVertex2f (-0.00, 0.20);
glVertex2f (-0.00, 0.10);
glEnd();
//right leg
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.40, -0.10);
glVertex2f (0.35, -0.10);
6. glVertex2f (0.35, -0.40);
glVertex2f (0.40, -0.40);
glVertex2f (0.35, -0.10);
glVertex2f (0.35, -0.40);
glVertex2f (0.40, -0.10);
glVertex2f (0.40, -0.40);
glEnd();
//left leg
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.15, -0.10);
glVertex2f (0.10, -0.10);
glVertex2f (0.10, -0.40);
glVertex2f (0.15, -0.40);
7. glVertex2f (0.10, -0.10);
glVertex2f (0.10, -0.40);
glVertex2f (0.15, -0.10);
glVertex2f (0.15, -0.40);
glEnd();
//right eye
glColor3f (0.0, 1.0, 1.0);
glBegin(GL_POINTS); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.29, 0.67);
glEnd();
//left eye
glColor3f (0.0, 1.0, 1.0);
glBegin(GL_POINTS); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.23, 0.67);
glEnd();
8. //line
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_LINES); // Center is at the mid of main window due to glOrtho()
glVertex2f (0.29, 0.61);
glVertex2f (0.23, 0.61);
glEnd();
glFlush ();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitWindowSize (600, 500);
glutInitWindowPosition (200, 100);
// Screen origin (0,0) is at Top Left
glutCreateWindow ("Hello Computer Graphics Students");
init();// calling init()
glutDisplayFunc(display); // glut call back function, calling display()
glutMainLoop();
return 0; // ANSI C requires main to return int.
}