OpenGL Tutorial 2D Moving Car

You will learn how to develop a 2D moving car with opengl tutorial.This very simple program made of simple polygon, See this opengl tutorial.
Rajeev
OpenGL Tutorial 2D Moving Car
In this post we are going to learn opengl tutorial on 2D Moving Car. This is very simple tutorial on opengl, which will teach how to make use of simple polygon functions. You can see the final output of below. We are going to make the 2D Car with simple polygon - triangle, quadrilateral and circle. In this opengl tutorial we are going to use these three simple polygon to create the car. Since we are going to make moving Car, hence first going to define the angle of movement. /* rotation angle for the triangle. */ float rtri = 0.0f; /* rotation angle for the quadrilateral. */ float rquad = 0.0f; Next step is to create a function that will generate the wheel of car. void drawBall(void) { glColor3f(0.0, 1.0, 0.0); //set ball colour glTranslatef(ballX,ballY,ballZ); //moving it toward the screen a bit on creation //glRotatef(ballX,ballX,ballY,ballZ); glutSolidSphere (0.3, 20, 20); //create ball. glTranslatef(ballX+1.5,ballY,ballZ); //moving it towar…

Post a Comment