Professional Documents
Culture Documents
"Rocket Launch": Visvesvaraya Technological University
"Rocket Launch": Visvesvaraya Technological University
"Rocket Launch": Visvesvaraya Technological University
A MINI PROJECT ON
“ROCKET LAUNCH”
A Mini Project submitted in partial fulfilment of the requirement for
the degree of
BACHELOR OF ENGINEERING
In
COMPUTER SCIENCE & ENGINEERING
Submitted by
FARHAAN PASHA 1RG18CS018
BASAVARAJ 1RG17CS068
Under the Guidance of
Mrs. Geetha Pawar
Asst. Prof. Dept. of CSE
RGIT, Bangalore – 36
____________________ ___________________
Signature of Guide Signature of HOD
Mrs. Geetha Pawar Mrs. Arudra A
Asst. Professor, Associate Prof. & HOD
Dept. of CSE Dept. of CSE
RGIT, Bangalore RGIT, Bangalore
EXTERNAL VIVA
Name of the Examiners Signature with Date
1.
2.
VISVESVARAYA TECHNOLOGY UNIVERSITY
JNANA SANGAMA, BELAGAVI – 590 018
DECLARATION
BASAVARAJ 1RG18CS068
ACKNOWLEDGEMENT
BASAVARAJ 1RG18CS068
ABSTRACT
primitive object.
Table of Contents
Certificate
Declaration
Acknowledgement
Abstract
CHAPTERS TITLE PAGE NO
1. INTRODUCTION
1.1 Computer Graphics 1
1.2 Application of computer graphics 1
1.2.1 Display of information 1
1.2.2 Design 2
1.2.3 Simulation & Animation 2
1.2.4 User Interface 2
1.3 Introduction to OpenGL 3
1.4 Pygame 3
1.5 Block Diagram of OpenGL 4
2. SYSTEM ANALYSIS
2.1 Existing System 5
2.2 Proposed System 5
2.3 Scope & Aim of Project 5
3. REQUIREMENT SPECIFICATION
3.1 User Requirement 6
3.2 Software Requirement 6
3.3 Hardware Requirement 6
4. IMPLEMENTATION
4.1 Built-in Function 7
4.2 Header Files/imports 11
4.3 Variable Declaration 11
4.4 Function Declaration 11
5. SCREENSHOTS 16
6. CONCLUSION
7. BIBLIOGRAPHY
ROCKET LAUNCH 2020-2021
CHAPTER 1
INTRODUCTION
Computer graphics is concerned with all aspects of producing pictures or images using a
computer. The field began humbly 50 years ago, with the display of few lines on a cathode-ray
tube (CRT). Now, we generate images with the computer that indistinguishable from the
photographs of real objects. We routinely train pilots with simulated airplanes, generating
graphical displays of a virtual environment in real time. Features length movies made entirely by
computers have been successful, both critically and financially.
The development of Computer Graphics had been driven both by needs of the user
community and by advances in hardware and software. The application of computer graphics are
many and varied, we can however divide them into of four major areas:
1. Display of information
2. Design
3. Simulation
4. User interface
Although many application span two or more of these areas, the development of the field was
based on separate work in each.
1.2.2 Design
Professions such as engineering and architecture are concerned with design. Starting with
a set of specifications, engineers and architects seek a cast effective and aesthetic solution that
satisfies the specifications.
Design is an interactive process. Design problems 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 behavior
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 computer at a cost less than that of movies with traditional ways.
To interface with the window system and to get input from external devices into programs, need
at least one more system-specific library that provides the “glue” between the window system
and OpenGL. For the X window system, this library is functionality that should be expected in
any modern windowing system. For this window system, GLUT will use GLX and the X
libraries. The application program, however, can use only GLUT functions and thus be
recompiled with the GLUT library for other window systems. We use GLU and C++ Library for
this project.
1.4 C
C++ programming language is a versatile programming language. Using C++ you can
create low end graphics too i.e. creating basic shapes and words with stylish fonts and adding
colors to them can be done using C++.
Graphic programming can be done in C++ using your terminal or command prompt or
you can download DevC++ compiler to create graphic programs. It includes computer graphics
and sound libraries designed to be used with the C++ programming language.
CHAPTER 2
SYSTEM ANALYSIS
2.3 Aim
The main aim is to develop a graphic program that utilizes the features of the computer graphics.
The objective is to graphically illustrate the launching of fully functional Rocket into the earth’s
atmosphere and make it revolve around the earth in its Orbit.
CHAPTER 3
REQUIREMENT SPECIFICATIONS
• Any Windows OS
• Editor : Visual Studio Code.
• Language : C++
• Ram: 4GB
• Hard Disk: 500GB (At least 80GB)
• Display: Intel HD graphics (128MB)
• Keyboard, Mouse
CHAPTER 4
IMPLEMENTATION
4.1.1 glRasterpos2i( )
mode: Specifies which matrix stack is the target for subsequent matrix operations. Three
values are accepted: GL_MODELVIEW , GL_PROJECTION , and GL_TEXTURE . The initial
value is GL_MODELVIEW . Additionally, if the ARB_imaging extension is supported,
GL_COLOR is also accepted.
4.1.4 glTranslate()
Multiply the current matrix by a translation matrix
glTranslate( ) -> glTranslate( x , y , z )
glTranslated( x , y , z ) glTranslatef( x , y , z )
4.1.5 glRotate()
multiply the current matrix by a rotation matrix
glRotate( )-> glRotate( angle , x , y , z )
glRotated( angle , x , y , z ) glRotatef( angle ,
x,y,z)
Slices: Specifies the number of subdivisions around the z axis (similar to lines of
longitude).
Stacks: Specifies the number of subdivisions along the z axis (similar to lines of latitude).
Inner: Specifies the inner radius of the partial disk (can be 0).
Outer: Specifies the outer radius of the partial disk.
Slices: Specifies the number of subdivisions around the z axis.
Loops: Specifies the number of concentric rings about the origin into which the partial
disk is subdivided.
Start: Specifies the starting angle, in degrees, of the disk portion.
Sweep: Specifies the sweep angle, in degrees, of the disk portion.
Draw: Specifies the desired draw style. Valid values are GLU_FILL , GLU_LINE ,
GLU_SILHOUETTE , and GLU_POINT .
Aspect: Specifies the aspect ratio that determines the field of view in the x direction. The
aspect ratio is the ratio of x (width) to y (height). zNear: Specifies the distance from the
viewer to the near clipping plane (always positive). zFar: Specifies the distance from the
viewer to the far clipping plane (always positive).
face: Specifies which face or faces are being updated. Must be one of GL_FRONT ,
GL_BACK , or GL_FRONT_AND_BACK .
pname: Specifies the single-valued material parameter of the face or faces that is being
updated. Must be GL_SHININESS .
param: Specifies the value that parameter GL_SHININESS will be set to.
#include<GL/glut.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
4.3.2 Planet-color
# color and other variables for easy modification planetColor
= (0.0, 0.6, 0.7)
partialDiskColor=(0.7, 0.4, 0.0)
# planet
glPushMatrix()
glTranslatef(1.8, 1.5, -6)
glRotatef(45,1,0,0)
glRotatef(angle,0,0,1)
gluSphere(quad, 2, slices, stacks) # quads, radius, slices, stacks
glPopMatrix()
# Rings
glColor3f(1.0, 0.8, 0.2) # controles the color of the rings
glPushMatrix() glTranslatef(1.8, 1.5, -6) # glRotatef(-60,
1, 0.2, 0) glRotatef(-angle, 0, 1, 1)
gluDisk(quad, 2.2, 2.7, slices, stacks) # quad, inner, outer, slices, loops
glPopMatrix()
# glColor3f(0.7, 0.5, 0.0) # If you need to change the color of the other ring
glPushMatrix() glTranslatef(1.8, 1.5, -6)
glRotatef(-60, 1, 0.2, 0) # pre rotated by an angle glRotatef(-
angle, 1, 0, 1) # contineous rotation of the ring gluDisk(quad, 2.2,
2.7, slices, stacks) # quad, inner, outer, slices, loops glPopMatrix()
quad = gluNewQuadric()
glPopMatrix()
def main():
slices = 7
stacks = 7
xrayButton = 1
xyz_pos = 0.1
movingDown = False
z_pos = -8
pygame.init()
display = (800, 600)
pygame.display.set_mode(display, DOUBLEBUF | OPENGL)
glMatrixMode(GL_PROJECTION)
gluPerspective(45, (display[0] / display[1]), 0.1, 50.0)
glMatrixMode(GL_MODELVIEW)
glTranslatef(-2.0, -1.0, -5) #
glTranslatef(0,0,-5) while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit() if event.type == pygame.KEYDOWN: if
event.key == pygame.K_UP: slices += 1 stacks +=
1 if event.key == pygame.K_DOWN and (slices > 3 and stacks >
3): slices -= 1 stacks -= 1 if event.key ==
pygame.K_x: xrayButton = xrayButton+1
# camera controles
if event.key == pygame.K_a:
glTranslatef(0.5, 0, 0) if
event.key == pygame.K_d:
glTranslatef(-0.5, 0, 0)
if event.key == pygame.K_w:
glTranslatef(0, -0.5, 0) if
event.key == pygame.K_s:
glTranslatef(0, 0.5, 0) if event.type ==
pygame.MOUSEBUTTONDOWN: if
event.button == 4: glTranslatef(0, 0, 0.5)
if event.button == 5: glTranslatef(0, 0, -0.5)
# logic to move the UFO if(movingDown):
if(xyz_pos > -4): xyz_pos = xyz_pos - 0.04
else:
movingDown = False
else:
if(xyz_pos < 8):
xyz_pos = xyz_pos + 0.04
else:
movingDown = True
# glRotatef(1, 3, 1, 1)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glColor3f(1.0, 1.0, 3.0)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LEQUAL)
glEnable(GL_LIGHT0)
glEnable(GL_NORMALIZE)
glEnable(GL_COLOR_MATERIAL)
glEnable(GL_LIGHTING)
pygame.display.flip()
pygame.time.wait(10)
angle = 0
main()
CHAPTER 5
SCREENSHOTS
FUTURE ENHANCEMENT:
To allow spectating mode for users to observe 3D objects better and Allow reposition of
Light sources to observe more of reflection effects on surface with shadow differential.
BIBLIOGRAPHY
Textbook Referred:
Interactive Computer Graphics, A Top-Down Approach with OpenGL – Edward
Angel, 5th Edition, Addison- Wesley- 2008
The official Guide to Learning OpenGL, by Jackie Nedier, Tom Davis, Mason
Woo (THE RED BOOK)
Website Referred:
https://github.com/DarkSchokolade/PyopenGL_Gubbins/bob/master/Plizzanet.py
www.pypi.org/projects/PyOpenGL/
www.stackoverflow.com
www.youtube.com