Car Model
Car Model
Car Model
CHAPTER 1
INTRODUCTION
Computer Graphics is one of the most powerful and interesting facets of computers.
There is a lot we can do in graphics apart from drawing figures of various shapes. All video
games, animation, multimedia predominantly works using computer graphics. There are so
many applications of computer graphics, which make it significant. Computer graphics is
concerned with all aspects of producing pictures or images using a computer.
OpenGL has become a widely accepted standard for developing graphics applications.
It can be used to implement several effects. Hence this project has become more colorful
because of the effects implemented using openGL.
CHAPTER 2
INTRODUCTION ABOUT OPENGL
OpenGL is a software interface to graphics hardware. This interface consists of
about 150 distinct commands that is used to specify the objects and operations needed to
produce interactive three-dimensional applications.
The color plate gives an idea of the kinds of things that can be done with the OpenGL
graphics system. The following list briefly describes the major graphics operations which
OpenGL performs to render an image on the screen.
• Construct shapes from geometric primitives, thereby creating mathematical
descriptions of objects. (OpenGL considers points, lines, polygons, images, and
bitmaps to be primitives.)
• Arrange the objects in three-dimensional space and select the desired vantage point
for viewing the composed scene.
• Calculate the color of all the objects. The color might be explicitly assigned by the
application, determined from specified lighting conditions, obtained by pasting a
texture onto the objects, or some combination of these three actions.
command glEnable () or glDisable (). Each state variable or mode has a default value, and
at any point the user can query the system for each variable's current value.
Display Lists
All data, whether it describes geometry or pixels, can be saved in a display list for
current or later use. When a display list is executed, the retained data is sent from the display
list just as if it were sent by the application in immediate mode.
Evaluators
All geometric primitives are eventually described by vertices. Parametric curves and
surfaces may be initially described by control points and polynomial functions called basis
functions. Evaluators provide a method to derive the vertices used to represent the surface
from the control points.
Per-Vertex Operations
For vertex data, next is the "per-vertex operations" stage, which converts the vertices
into primitives. Some vertex data are transformed by 4 x 4 floating-point matrices. Spatial
coordinates are projected from a position in the 3D world to a position on the screen.
Primitive Assembly
Clipping, a major part of primitive assembly, is the elimination of portions of
geometry which fall outside a half-space, defined by a plane. Point clipping simply passes
or rejects vertices; line or polygon clipping can add additional vertices depending upon how
the line or polygon is clipped. The results of this stage are complete geometric primitives,
which are the transformed and clipped vertices with related color, depth, and sometimes
textureco-ordinate values and guidelines for the rasterization step.
CHAPTER 3
REQUIREMENT SPECIFICATIONS
• Hardware Requirements
• Software Requirements
• Functional Requirements
• Non-Functional Requirements
Characteristics required of the interface between the software product and each of the
hardware components
Any mouse and keyboard that works with Win Forms
Program will use windows print APIs to interface with printer.Interface with other
software components or products, including other systems, utility software, databases, and
operating systems.
OpenGL libraries for required are
• GLUT library
• STDLIB library
The application is very self-contained. Robust error handling will be implemented and
code will be object-oriented to allow for easier maintenance and feature additions.
This model runs using Microsoft Visual Studio version 2010 on a Windows XP platform.
• RAM: 1 GB
• Keyboard: Standard
• Mouse: Standard
Some specific hardware requirements are needed for Visual Studio 2010 .They can be listed
as:
Requirement Professional
With MSDN:
• Performance has not been tuned for minimum system configuration. Increasing
the RAM above the recommended system configuration will improve
performance, specifically when there are running multiple applications,
working with large projects, or doing enterprise-level development.
These are the statements of services the system should provide, how the system should
react to particular inputs and how the system should behave in particular situations. In some
cases, the functional requirements may also explicitly state what the system should not do.
CHAPTER 4
DESIGN PHASE
Design of any software depends on the architecture of the machine on which that
software runs, for which the designer needs to know the system architecture. Design
process involves design of suitable algorithms, modules, subsystems, interfaces etc.
This project has been created using the OpenGL interface along with the GLUT(OpenGL
Library Tool), using the platform Visual C++ 6.0 as a compiling tool. This project has been
designed in a simple and lucid manner so that further developments can be made, and run
on many platforms with a few changes in the code.
4.1 Algorithm
Create_menu ( )
Step 2: Create_menu ( )
Dept Of CSE Page 11
Mini Project Report 2023-2024
glutAttachMenu (GLUT_RIGHT_BUTTON).
ResizeGLscene ( )
Perform Transformations
Transform ( )
Transform ( )
display1( )
DrawGLScene ( )
if view is 0 then
display1( ) else
{ InitGL( )
Enable rotation by along the three axes using
glRotatef( xangle,1.0 ,0.0 ,0.0 )
glRotatef(yangle,0.0, 1.0, 0.0) glRotatef(zangle,
0.0, 0.0, 1.0)
Enable translation by calling glTranslatef (xt, yt, zt)
glutSwapBuffers( );
} //end ofelse
} //end of DrawGLScene( )
SpecialkeyFunc(key, x, y)
Step 10: The actions performed by each menu entry identified by id.
myMenu( id )
Data flow diagrams show how data is processed at different stages in the system. Data
flow models are used to show how data flows through a sequence of processing steps. The
data is transformed at each step before moving on to the next stage. These processing steps
of transformations are program functions when data flow diagrams are used to document a
software design.
The use of space bar allows the user to enter into the display mode. The movement of
the car can be done using left and right arrow keys. The X/x, Y/y, Z/z keys are used
for corresponding rotation in clockwise or anti-clockwise direction. A/a, Q/q, S/s for
custom size collection.U/u, F/f for camera view settings. The escape key enables the
user to exit.
The other effects can be viewed by selecting the appropriate menu. The menu can
be viewed by pressing the right mouse button. Menu callback is used to implement
these
Main ()
functions.
ChangeSize
RenderScene SetupRC
SpecialKeys
glPopMatrix () glLightfv ()
glMatrixMode() GLUT_KEY_DOW
glRotatef () glColorMateri
glLoadIdentity() GLUT_KEY_LEF
T glEnable al
glBegin glColor3f
CHAPTER 5
IMPLEMENTATION
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
char s[30];
void renderBitmapString(float x, float y, void *font, const char *string)
{
const char *c;
glRasterPos2f(x, y);
for (c = string; *c != '\0'; c++)
{
glutBitmapCharacter(font, *c);
}
}
5.3.4 Bottom
glColor3f(1.000, 1.000, 0.000);
glBegin(GL_POLYGON);
glVertex2f(48, roadDivBtm + 0);
glVertex2f(48, roadDivBtm + 20);
glVertex2f(52, roadDivBtm + 20);
glVertex2f(52, roadDivBtm + 0);
glEnd();
roadDivBtm = roadDivBtm - 0.5;
if (roadDivBtm < -20)
{
roadDivBtm = 100;
score++;
}
glBegin(GL_POLYGON);
glVertex2f(lrIndex + 26, 1);
glVertex2f(lrIndex + 26, 8);
glColor3f(0.000, 0.545, 0.545);
);
glVertex2f(lrIndex2 + 26 - 2, car2 + 100);
glVertex2f(lrIndex2 + 26 - 2, car2 + 100 - 2);
5.8 Hill
glColor3f(0.000, 0.400, 0.000);
glBegin(GL_TRIANGLES);
glVertex2f(70, 70);
glVertex2f(90, 55);
glVertex2f(50, 55);
glEnd();
glColor3f(00, 0, 0.000);
glBegin(GL_POLYGON);
glVertex2f(32 - 4, 50 + 5 + 10);
glVertex2f(32 + 46, 50 + 5 + 10);
glVertex2f(32 + 46, 50 + 4 + 10);
glVertex2f(32 - 4, 50 + 4 + 10);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(32 + 45, 50 + 5 + 10);
glVertex2f(32 + 46, 50 + 5 + 10);
glVertex2f(32 + 46, 50 - 15 + 10);
glVertex2f(32 + 45, 50 - 15 + 10);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(32 - 4, 50 - 14 + 10);
glVertex2f(32 + 46, 50 - 14 + 10);
glVertex2f(32 + 46, 50 - 15 + 10);
glVertex2f(32 - 4, 50 - 15 + 10);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(32 - 4, 50 + 5 + 10);
glVertex2f(32 - 5, 50 + 5 + 10);
glVertex2f(32 - 5, 50 - 15 + 10);
glVertex2f(32 - 4, 50 - 15 + 10);
glEnd();
glColor3f(1.000, 1.000, 0.000);
renderBitmapString(30, 80, (void *)font1, "2D Car Racing Game ");
glColor3f(0.000, 1.000, 0.000);
renderBitmapString(30, 50 + 10, (void *)font2, "Press SPACE to Start");
renderBitmapString(30, 50 - 3 + 10, (void *)font2, "Press ESC to Exit");
glColor3f(1.000, 1.000, 1.000);
renderBitmapString(30, 50 - 6 + 10, (void *)font3, "Press UP to Increase Speed");
renderBitmapString(30, 50 - 8 + 10, (void *)font3, "Press DWON to Decrease Speed");
renderBitmapString(30, 50 - 10 + 10, (void *)font3, "Press RIGHT to Turn Right");
}
}
void processKeys(unsigned char key, int x, int y)
{
switch (key)
{
return 0;
}
CHAPTER 6
TESTING
6.1 Testing
Testing is the process of executing a program to find the errors. A good test has the
high probability of finding a yet undiscovered error. A test is vital to the success of the
system. System test makes a logical assumption that if all parts of the system are correct,
then goal will be successfully achieved.
Input Expected Output Output Status
Car Model Mode This places the car Car is placed against
against a plain A plain background
background which is Which helps to view Success
helpful in viewing the the car model
car model
Car Driving Mode Car is placed on the Car is placed on the
road having road having Success
greenery on its sides greenery on its
sides
Fod Effect The entire display is The entire display is
covered with fog covered with fog Success
• Integration Testing
• System Testing
The input device used is mouse which has been tested for correct operation.
component. The initial component was the creation of bird. This was system – tested with
the addition of translation of the bird. These two were retested with the case where the bird
hits the target and the target successfully disappears
Unit Testing
Integration
Testing
System
Testing
CHAPTER 7
RESULTS
The Help window displays the details about the usage of various keys and mouse
button in this project. It is immediately displayed when the program begins its execution.
This is the display seen when driving mode is selected from the menu. All the effects
seen in car model mode can also be viewed in this mode by pressing appropriate keys and
options in menu.
This is the display obtained when the right mouse button is pressed and menus are
viewed. Here the car colors menu is chosen and a submenu called yellow is chosen. Hence
the car turned to yellow. Various options in the menu can be viewed in the above figure.
Dispaly while in the game the car is crashing with another car and the stops and
return to menu window.
Conclusion
This game is an open world game that a player can enjoy without ever worrying
about game’s end. A player must complete the tasks in order to win the race. The Game
will consist of 2 scenes where every scene has its own environment.. The player will start
the game from starting point, and he will again come to that point at end. This Game is just
an initial version.
This game is a part of a bigger educational process is really in the core mind-set
that this project wants to promote. Games can do many things very well, but they certainly
cannot do everything at once .. Many new things learnt by implementing this I have went
through various events ,functions and keyboards in Unity .This project aimed as much at
using alternative and innovative methods to teach through coding digital games and
playing games as part of learning, as at developing the skills in extending academic goals
to understand, support and include the whole child: not only their academic subject skills
but also social, emotional and behavioural skills.
References
• "Computer Networks: A Systems Approach" by Larry L. Peterson and Bruce S.
• "Traffic and Congestion Control in IP/TCP Networks" by Raghupathy Sivakumar,
• Prathima Agrawal, and Mohan Gurusamy
• Donald D Hearn, M Pauline Baker and WarrenCarithers: Computer Graphics with
OpenGL 4th
• Edition, Pearson, 2014
• S.Sridhar, Digital Image Processing, second edition, Oxford University press 2016.
• http://jerome.jouvie.free.fr/OpenGl/Lessons/Lesson3.php
• http://google.com
• http://opengl.org