CG Report Sample
CG Report Sample
Chapter 1
INTRODUCTION
The dominant characteristics of this new computer and communication technologies have
become dominant forces in our life. Activities as wide ranging as filmmaking, publishing,
banking and education continue to undergo revolutionary changes as these technologies alter
the ways in which we conduct our daily activities. The combination of computers , networks,
and the complex visual system, through the computer graphics has led to new way of
displaying information, seeing virtual worlds and communicating with people and machines.
Computer graphics is concerned with all aspects of producing pictures or images using a
computer. The field has begun humbly almost 50 years ago, with a display of few lines on a
cathode ray tube, now we can create images by computer that are indistinguishable from
photographs of real objects. We routinely train pilots with simulated airplanes, generating
graphical displays of virtual environment of real time. Feature length movies made entirely
by computer have been successful, both critically and financially. Massive multiplayer games
can involve tens of thousands of concurrent participants.
1.1 GLUT:
It is complete API written by mark kilogram, which lets us create windows and handle the
messages. It exists for several platforms that a program, which uses GLUT, can be compiled
on many platforms without any changes in the code.
ADDITONAL LIBRARIES:
1 .glu :It is a set of utility functions, they are easy way of doing things that is tedious with
raw OpenGL.
2. glx :It allows you to open up X window and link it up with OpenGL so that it will draw to
that window.
To be hardware independent OpenGL provides its own data types, they all begin with “GL”.
Eg: GLfloat, Glint. There are also many symbolic constants that all begin with ”GL”. Eg:
GL_POINTS, GL_LINES. Finally commands have prefix ”gl”. Eg: glVertex3f (f, i, d).
There are utility library called as “GLU”. Here the prefixes are “GLU_”, ”glu”. GLUT
commands begin with “glut” it is same for every library. OpenGL is a widely accepted
standard for developing graphics applications. Fortunately, OpenGL is easy to learn and it
possesses most of the characteristics of other graphics systems. Graphics API’s such as
OpenGL, developed as a way to provide application programmers with the access to
hardware features that were being provided by the latest graphics hardware.
The development of computer graphics has been driven both by needs of the user
community and by advancement in technology. The applications of computer graphics of
computer graphics are many and varied, we can divide them into four categories :
1. Display of information
2. Design
4. User interface
1. Display of Information:
Medical imaging possesses interesting and important data analysis problem. Modern imaging
technologies such as computed tomography (CT), magnetic resonance imaging(MRI),
ultrasound, and position emission tomography(PET), generate 3D data that must be subjected
to algorithmic manipulation to provide useful information.
The field of scientific visualization provides graphical tools that help the researchers interpret
the fast quantity of data that generate.
2. Design:
Professions such as engineering and architecture are concerned with design. Starting with a
set of specifications, engineers and architects seek a cost effective and esthetical solution that
satisfies the specifications.
Design is an interactive process. Design problem are either over determined such that they
possess no solution that satisfies all criteria, much less an optimal solution, or undetermined,
such that they have multiple solutions that satisfies the design criteria.
The simulators can be used for designing the robot, planning its path, and simulating its
behaviour in complex environment. The success of flight simulators led to the use of
computer graphics for animation in TV, motion pictures and advertising industries. Entire
animated movies can now be made by computers at a cost less than that of movies made with
traditional ways.
4.User interface:
Our interaction with computers has become dominated by visual paradigm that includes
icons, menus and pointing devices such as mouse. From users perspectives, winding system
such as X and window system, Microsoft windows.
1.3 OPENGL:
OpenGL provide a set of commands to render a two dimensional scene. That means you
provide data in OpenGL usable form and OpenGL will show you this data in scene (render
it).it is developed by many companies and it is free for use. You can develop OpenGL
applications without licensing.
OpenGL based on the state variables, there are many values for example, the colour, you can
specify a colour once and draw several polygons, lines and whatever you want. Then there
are no classes like in directX. However it is logically structured. Before we come to the
commands themselves, here are another thing.
To be hardware independent, OpenGL provides its own data types . They all begin with
“GL”. For ex: GLfloat, GLint and so on. There are also many symbolic constants; they all
begin with “GL” for ex: GL_POINTS, GL_LINES. Finally the commands have the prefix
“gl”. There is utility library called GLU, here the prefixes are “GLU” & “glu”. It is same for
every library. You want to know which library coexist with the one called before. There are
libraries for every system. Windows as the wgl*functions, UNIX system glx* and so on.
It is very important thing to know, that there are two important matrices, which affect the
transformation from 3D world to 3Dscreen. The projection matrix and the model view
matrix. The projection matrix contains information, how a vertex can be mapped tom the
screen. This contains, whether the projection shall be isometric or a form of perspective, how
wide the field of view is and so on. Into the other matrix you put information, how the objects
are moved, where the viewer is and so on.
Commands may be either be accumulated in display lists are processed immediately through
pipeline architecture. Display lists allow for greater optimization and command reuse, but not
all commands can be put in display lists.
The first stage is evaluator. This stage effectively takes any polynomial evaluator commands
and evaluates them into their corresponding vertex and attributes commands
The fourth stage is the per-fragment operations. Before fragments go to the frame buffer, they
may subjected to a series of conditional tests and modifications, such as blending or Z-
buffering.
The goal of this simulation is to fly as far as possible, with four controls at your disposal, this
is one of those “easy to learn, difficult to master” situations. You’ll first be provided with a
plane and a scene.
Click ‘G’ to start make your little green guy take off from the land, and it’s on!! As you
fly,you are given controls to move your plane around the screen. So it’s critical to master this
bouncy method of flying. Rings of varying sizes are placed around the scene. So, you’ll
spend most of your time avoiding these or you can dodge through them.
As far as the simulation interface is concerned, you’ll be greeted with a loading screen with
will display the name of game followed by the instruction to start the game . You’ll then see a
menu on the screen once the simulation starts with the following items:
• Up ‘W’
• Down ‘S’
• Right ‘ D’
• Left ‘ A’
The user can start the game directly ,by clicking in the word ‘G’. Otherwise, he can view the
instruction as to the simulation starts . If the player has changed his mind to play the game
sometime later, he can click on “M” button which terminates the game.
Chapter 2
SYSTEM REQUIREMENTS
A visual C/C++ compiler is required for compiling the source code to make a
executable file which can be directly executed.
The built in graphics and dynamic link libraries like glut and glut32, and header file
like glut.h to create 3D&3D layout.
RAM : 64 MB or above
Chapter 3
PROJECT DESIGN
3.1 PURPOSE
Demonstration of simulation of a 3D Aeroplane design.
3.2 DESCRIPTION
Click ‘G’ to start make your little green guy take off from the land, and it’s on!! As you
fly,you are given controls to move your plane around the screen. So it’s critical to master this
bouncy method of flying. Rings of varying sizes are placed around the scene. So, you’ll
spend most of your time avoiding these or you can dodge through them.
As far as the simulation interface is concerned, you’ll be greeted with a loading screen with
will display the name of game followed by the instruction to start the game . You’ll then see a
menu on the screen once the simulation starts with the following items:
• Up ‘W’
• Down ‘S’
• Right ‘ D’
• Left ‘ A’
The user can start the game directly ,by clicking in the word ‘G’. Otherwise, he can view the
instruction as to the simulation starts . If the player has changed his mind to play the game
sometime later, he can click on “M” button which terminates the game.
MAIN
KEYBOARD KEYS
W or w S or s A or a D or d
EVENTS OR
END
STOP
Chapter 4
IMPLEMENTATION
This program has been developed and implemented using OpenGL interface. In
corporate this facility includes glut.h header files.
Void glEnd()
Terminates a list of vertices.
4.1 Attributes
Void glFlush()
Forces any buffered openGL commands to execute.
Initializes GLUT. The arguments from main are passed in and can be used by the application.
Void glutCreateWindow(char*title)
Creates a window on the display. The string title can be used by the window. The return value
provides reference to the windows that can be used when there are multiple windows.
void glutInitDisplayMode(unsigned int mode)
Requests a display with the properties in mode. The value of mode is determined by the
logical OR of options including the colormodel(GLUT_RGB, GLUT_INDEX) and buffering
(GLUT_SINGLE,GLUT_DOUBLE).
void glutInitWindowPosition(intx,int y)
Specifies the initial position of top-left corner of the window in pixels.
void glutMainLoop()
Causes the program to enter an event processing loop. It should be the lat statement in main.
Void glutDisplayFunc(void(*func)(void))
Requests that the display callback be executed after the current callback returns.
void glutSwapBuffers()
Swaps the front and back buffers.
4.3 Interaction
Registers the reshape callback function f. The callbackfunc returns the height and
width of the new window. The reshape callback invokes display callback.
4.4 Transformation
4.5 Viewing
4.6 Lighting
glColor3d(1,1,1);
glPushMatrix();
glTranslated(0,1.68,-0.4);
glScaled(0.5,0.02,0.08);
glutSolidCube(1);
glPopMatrix();
/// Piller
glPushMatrix();
glTranslated(0,1.99,-0.4);
glScaled(0.06,0.7,0.04);
glutSolidCube(1);
glPopMatrix();
/// ROD
glColor3d(0,0,0);
glPushMatrix();
glTranslated(0.07,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.11,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.15,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
///
glPushMatrix();
glTranslated(-0.22,0,0);
glPushMatrix();
glTranslated(0.07,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.11,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.15,1.99,-0.4);
glScaled(0.003,0.7,0.003);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();
///Horizontal rod
glPushMatrix();
glTranslated(2.2,0,-0.1);
glScaled(4.2,1,1);
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.528,1.85,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,2.02,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,2.18,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glColor3d(1,1,1);
glPopMatrix();
/// ROD END
glColor3d(1,1,1);
glPushMatrix();
glTranslated(-0.22,1.99,-0.4);
glScaled(0.06,0.7,0.04);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.22,1.99,-0.4);
glScaled(0.06,0.7,0.04);
glutSolidCube(1);
glPopMatrix();
/// Uporer piller
glPushMatrix();
glTranslated(0,0.743,-1.424);
glRotated(45,1,0,0);
//glColor3d(1,0,1);
glPushMatrix();
glTranslated(0,1.99,-0.4);
glScaled(0.06,0.3,0.04);
glutSolidCube(1);
glPopMatrix();
//glColor3d(1,1,1);
glPushMatrix();
glTranslated(-0.22,1.99,-0.4);
glScaled(0.06,0.3,0.04);
glutSolidCube(1);
glPopMatrix()
glPushMatrix();
glTranslated(0.22,1.99,-0.4);
glScaled(0.06,0.3,0.04);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0,2.15,-0.4);
glScaled(0.5,0.04,0.04);
glutSolidCube(1);
glPopMatrix();
///ROD
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.641,0.43,0.1);
glScaled(1,0.73,1);
glPushMatrix();
glTranslated(0.078,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.11,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.145,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();
///Horizontal rod
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.528,1.8,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,1.96,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glColor3d(1,1,1);
///ROD
glPopMatrix()
/// pasher piller left 2
glPushMatrix();
glTranslated(0.83,0,0.39);
glRotated(-45,0,1,0);
glPushMatrix();
glTranslated(-0.605,1.88,-0.3);
glScaled(0.045,0.4,0.03);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.45,1.88,-0.3);
glScaled(0.045,0.4,0.03);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,2.1,-0.3);
glScaled(0.199,0.04,0.03);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,1.68,-0.3);
glScaled(0.199,0.02,0.06);
glutSolidCube(1);
glPopMatrix();
///Horizontal rod
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.528,1.8,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-0.528,1.96,-0.3);
glScaled(0.1,0.003,0.003);
glutSolidCube(1);
glPopMatrix();
glColor3d(1,1,1);
///ROD
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.641,0.43,0.1);
glScaled(1,0.73,1);
glPushMatrix();
glTranslated(0.078,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.11,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(0.145,1.99,-0.4);
glScaled(0.003,0.56,0.003);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();
glColor3d(1,1,1);
///ROD
glPopMatrix();
glPopMatrix();
/// Circle
glColor3d(1,0,0);
glPushMatrix();
glTranslated(0,2.1,-0.44);
glScaled(0.35,0.35,0.01);
glutSolidSphere(1,50,50);
glPopMatrix();
glColor3d(0,0,0);
glPushMatrix();
glTranslated(-0.18,1.9,-0.45);
glScaled(0.01,0.5,0.01);
glutSolidCube(1);
glPopMatrix();
glColor3d(0,0,0);
glPushMatrix();
glTranslated(0.18,1.9,-0.45);
glScaled(0.01,0.5,0.01);
glutSolidCube(1);
glPopMatrix();
///left
glColor3d(0.8,1,0);
glPushMatrix();
glTranslated(0.4,0,-1.5);
glRotated(30,0,1,0);
glScaled(0.7,0.1,3);
glRotated(-10,0,1,0);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();
/// Pesoner Uporer pakha
glColor3d(0.8,1,0);
glPushMatrix();
glTranslated(-2.7,0.5,0);
glRotated(45,0,0,1);
glScaled(0.8,2,0.1);
glRotated(-20,0,0,1);
glutSolidCube(0.5);
glPopMatrix();
// glColor3d(0.8,1,0);
// glPushMatrix();
// glTranslated(-2.95,0.85,0);
// glRotated(90,0,1,0);
// glScaled(0.05,0.05,0.6);
// glutSolidTorus(0.5,0.5,50,50);
// glPopMatrix();
void soheedMinarEnv(){
/// Ground
glColor3d(0,0.5,0.1);
glPushMatrix();
glTranslated(0,0,0);
glScaled(EN_SIZE*2,0.3,EN_SIZE*2);
glutSolidCube(1);
glPopMatrix();
glPushMatrix();
glTranslated(-8,-2.7,-5);
glRotated(65,0,1,0);
//glRotated(15,0,1,0);
glScaled(2,2,2);
drawShohidMinar();
glPopMatrix();
glPushMatrix();
glTranslated(8,-2.7,-5);
glRotated(-65,0,1,0);
//glRotated(15,0,1,0);
glScaled(2,2,2);
drawShohidMinar();
glPopMatrix();
}
void environment(int n){
///Plane
if(rotX>11)rotX=11;
//cout<<rotX<<" "<<rotY<<" "<<rotZ<<endl;
speed += 0.0002;
if(speed>=0.7)speed=0.7;
}
void drawBitmapText(char *str,float x,float y,float z)
{
char *c;
glRasterPos3f(x,y+8,z);
for (c=str; *c != '\0'; c++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, *c);
}
}
void drawStrokeText(char* str,int x,int y,int z)
{
char *c;
glPushMatrix();
glTranslatef(x, y+8,z);
glScalef(0.002f,0.002f,z);
for (c=str; *c != '\0'; c++)
{
glutStrokeCharacter(GLUT_STROKE_ROMAN , *c);
}
glPopMatrix();
}
void drawStrokeText2(char* str,int x,int y,int z)
{
char *c;
glPushMatrix();
glTranslatef(x, y+8,z);
glScalef(0.005f,0.005f,z);
for (c=str; *c != '\0'; c++)
{
glutStrokeCharacter(GLUT_STROKE_ROMAN , *c);
}
glPopMatrix();
}
void drawStrokeChar(char c,float x,float y,float z)
{
glPushMatrix();
glTranslatef(x, y+8,z);
glScalef(0.002f,0.002f,z);
glutStrokeCharacter(GLUT_STROKE_ROMAN , c);
glPopMatrix();
}
static void display(void)
{
const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
double a = t*90.0;
double aa=a;
if(!rot){
a=0;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt( 0.0, 4.5, 10.0,
0, 4, 0,
0, 1.0f, 0.0f)
if(START){
glPushMatrix();
glTranslated(0,0,0);
glScaled(zoom,zoom,zoom);
glRotated(a,0,1,0);
draw();
glPopMatrix();
drawStrokeText("UP: W, DOWN: S, LEFT: A, RIGHT: D, MAIN MENU: M",-8,0.9,0);
drawStrokeText("TIME : ",3,0,0);
int mod,number=0;
while(TIME){
mod=TIME%10;
number=number*10+mod;
TIME/=10;
}
float tmp=0;
while(number){
mod=number%10;
drawStrokeChar(mod+48,4+tmp,0,0);
number/=10;
tmp+=0.2;
}
}
else{
glPushMatrix();
glTranslated(0,3,0);
glRotated(aa,0,1,0);
glScaled(1.5,1.5,1.5);
plane();
glPopMatrix();
drawStrokeText("Press G to Start",-1,-1,0);
drawStrokeText2("Plane Game",-2,0,0);
}
//glColor3d(1,1,0);
//drawStrokeText("Osama Hosam's OpenGL Tutorials",200,200,0);
// glRasterPos2i(100, 120);
// glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
glutInitWindowSize(1366,720);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA);
glutCreateWindow("GLUT Shapes");
glutReshapeFunc(resize);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutIdleFunc(idle);
//PlaySound("starwars.wav", NULL, SND_ASYNC|SND_FILENAME|SND_LOOP);
glClearColor(1,1,1,1);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
Chapter 5
SNAPSHOTS
Chapter 6
TESTING
6.1 TESTING
Software testing is a critical element of the ultimate review of specification design
and coding. Testing of software leads to the uncovering of errors in the software functional
and performance requirements are met. Testing also provides a good indication of software
reliability and software quality as a whole. The result of different phases of testing are
evaluated and then compared with the expected results. If the errors are uncovered they are
debugged and corrected. A strategy approach to software testing has the generic
characteristics:
o Debugging by Induction
o Debugging by Deduction
o Backtracking
CONCLUSIONS
An attempt has been made to develop , design and implement a ‘3DAeroplane Simulation’.
OpenGI supports enormous flexibility in the design and the use of OpenGl graphics
programs. The presence of many built in classes methods take care of much functionality and
reduce the job of coding as well as makes the implementation simpler.
The project was started with the designing phase in which we figured the requirements
needed, the layout design, then comes the detail designing of each function after which, was
the testing and debugging stage. We have tried to implement the project making it as user-
friendly and error free as possible. We regret any errors that may have inadvertently crept in.
The development of mini project has given us a good exposure to OpenGL by which we have
learnt some of the techniques which helps in the development of animation and gaming.
Hence it is helpful for us to even take this field as our career too and develop some other
features in openGL and provide as token of contribution to the graphics world.
FUTURE ENHANCEMENT
This project has been designed using C++, which works on the windows platform. The
project can be designed using other languages and better graphical interfaces. The following
features could have been incorporated.
Virtual Reality (VR) Support: Add support for virtual reality headsets, allowing users
to experience the simulation in an immersive and 3D environment. VR technology
can greatly enhance the sense of presence and realism.
Realistic Physics Simulation: Enhance the physics simulation to accurately model the
behavior of the airplane in different flight conditions, including aerodynamics, lift,
drag, and turbulence. This will provide a more realistic flying experience for the
users.
Real-world Scenery: Integrate satellite imagery and terrain data to create realistic
scenery, including airports, cities, and landmarks. This will enhance the visual
experience and make the simulation feel more authentic.
Aircraft Customization: Allow users to customize the appearance of their aircraft with
different liveries, paint schemes, and decals. This feature gives users a sense of
ownership and allows them to personalize their flying experience.
REFERENCES
BIBLIOGRAPHY
WEBSITES
[5] www.OpenGLRedbook.com
[6] www.OpenGLsimpleexamples.com
[7] freeglut.sourceforge.net/
[ 8] Opengl.org/documentation/
[9] Opengl.org/discussion_boards/