0% found this document useful (0 votes)
412 views

CG Report

This document provides details about a mini project to simulate the Mangalyaan (Mars Orbiter Mission) spacecraft using OpenGL. It includes 3 main components: 1) An introductory screen displaying the project title, student names, and instructor details. 2) Implementation of functions to display the rocket, spacecraft, stars, and facts about Mangalyaan's orbit. Functions include frontscreen(), display(), stars(), stars1(), and rocket(). 3) The rocket() function creates the 3D model of the PSLV rocket using OpenGL polygons with color definitions. The project allows visualization and interaction of the MOM spacecraft and components to demonstrate OpenGL graphics functions.

Uploaded by

Sunny Kushal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
412 views

CG Report

This document provides details about a mini project to simulate the Mangalyaan (Mars Orbiter Mission) spacecraft using OpenGL. It includes 3 main components: 1) An introductory screen displaying the project title, student names, and instructor details. 2) Implementation of functions to display the rocket, spacecraft, stars, and facts about Mangalyaan's orbit. Functions include frontscreen(), display(), stars(), stars1(), and rocket(). 3) The rocket() function creates the 3D model of the PSLV rocket using OpenGL polygons with color definitions. The project allows visualization and interaction of the MOM spacecraft and components to demonstrate OpenGL graphics functions.

Uploaded by

Sunny Kushal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

(ISO 9001:2015 Certified), Accredited with ‘A’ Grade by NAAC

: 08258 - 281039 – 281263, Fax: 08258 – 281265

Report on Mini Project

“Mangalyaan”
Course Code: 19CS607
Course Name: Computer Graphics Lab

Semester: 6 Section : C

Submitted To
Mr. Pradeep Kanchan
Asst Prof Gd III, Dept of CSE, NMAMIT

Submitted By

Name: P. Kushal USN: 4NM19CS124


Name: Pankaj Kumar USN: 4NM19CS125

Date of submission: 02/06/2022

Signature of Course Instructor

1
ABSTRACT:
In this project, we aim to implement an visual model of Mangalyaan using
OpenGL, which is an open-source cross platform interface for rendering 2D and
3D graphics. The implementation will comprise of a PSLV-XL C25 rocket, and the
entire space probe that was present during the MOM mission. The components of
each of these will be explained in detail in this report.
It will also allow user interactions using mouse and keyboard. It also has
background change effects. Through this, we will be able to understand important
OpenGL functions and GLUT libraries. This project helps us familiarize ourselves
in the implementation of transformations like translation, rotation and scaling,
properties of light, movement etc. on different objects.

2
TABLE OF CONTENTS

TITLE PAGE NO.

1. INTRODUCTION 4

2. IMPLEMENTATION DETAILS 5-25

3. CONCLUSION 26

4. REFERENCES 27

5. APPENDIX 28-31

3
INTRODUCTION:

Computer Graphics involves technology that is vital to access the functions of a


computer. The Process transforms and presents information in a visual form.
Computer graphics plays an inevitable role in functioning of a computer by
enabling the user interface visually. In today’s life, computer graphics has now
become a common element in user interfaces, T.V. commercial motion pictures.

OpenGL (short for Open Graphics Library) is a cross-language, cross-platform


application programming interface for rendering 2D and 3D vector graphics. The
API is typically used to interact with a graphics processing unit, to achieve
hardware- accelerated rendering.

The project contains a full-fledged visual demonstration of the iconic Mars Orbiter
Mission. The components can be broadly classified into an external view of the
PSLV rocket that was used in the Mangalyaan mission and its journey to mars can
be seen in this simulation.

Firstly, the user is greeted with a title screen. On a keyboard click, the user is taken
to the external view, which is the first component.

This project is developed in C/C++ in Code Blocks. Keyboard is the input device
used which will also allow the user to interact with the application and also
controls transition between the two views, internal and external view of the
simulation.

4
IMPLEMENTATION DETAILS:
The project “Mangalyaan” is created by using a set of functions for the
respective components of the simulation.
1. void frontscreen() function displays the names in the introductory window:

void frontscreen(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
setFont(GLUT_BITMAP_TIMES_ROMAN_24);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,0);
drawstring(-12.0,60.0,0.0,"NMAMIT, NITTE ");
glColor3f(0,0,0);
drawstring(-42,52,0.0,"DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING");
glColor3f(0,0,0);
drawstring(-16,40,0.0,"A MINI PROJECT ON");
glColor3f(0,0,0);
drawstring(-13,30,0.0,"MANGALYAAN");
glColor3f(0,0,0);
drawstring(-3,20,0.0,"BY:");
glColor3f(0,0,0);
drawstring(-20,10,0.0,"P.KUSHAL 4NM19CS124");
drawstring(-23,0,0.0,"PANKAJ KUMAR 4NM19CS125");
glColor3f(0,0,0);
drawstring(-18,-10,0.0,"UNDER GUIDANCE OF:");
glColor3f(0,0,0);
drawstring(-20,-20,0.0,"MR. PRADEEP KANCHAN");
drawstring(-25,-29,0.0,"ASST. PROF GD III(M.TECH(PHD))");
glColor3f(1,0,0);
drawstring(-40,-40,0.0,"FOR A QUICK SUMUP ABOUT MOM PRESS ENTER");
glFlush();
}

5
2. Void Display() for facts on Mangalyaan.

void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
setFont(GLUT_BITMAP_TIMES_ROMAN_24);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,0);
drawstring(-10.0,85.0,0.0,"ABOUT");
glColor3f(0,0,0);
drawstring(-99,70,0.0,"Mangalyaan entered Mars orbit with its closest point to the planet at
about 420 kilometers (about 261 miles) and farthest at about 80,000 kilometers ");
glColor3f(0,0,0);
drawstring(-99,60,0.0,"which is a much longer orbit than all its contemporary Mars missions.
Over the years, ISRO has reduced the orbit’s size but it hasn’t appreciably changed");
glColor3f(0,0,0);
drawstring(-99,50,0.0,"relative to other missions. For example, NASA’s Mars Reconnaissance
Orbiter mapping mission has a nearly circular orbit of about 300 kilometers while");
glColor3f(0,0,0);
drawstring(-99,40,0.0,"ESA’s Mars Express has an orbit of 300 by 10,000 kilometers (about
186 by 6214 miles).");

glColor3f(0,0,0);
drawstring(-69,0,0.0,"Mangalyaan’s large and highly elliptical Mars orbit is again tied to its
choice of launching on a PSLV rocket.");
glColor3f(0,0,0);
drawstring(-69,-10,0.0,"For the PSLV to place Mangalyaan in the desired Earth orbit, the
spacecraft couldn’t be any heavier than it was");
glColor3f(0,0,0);
drawstring(-69,-20,0.0,"— it couldn’t carry any more fuel.And because Mangalyaan had to
get out of Earth orbit by itself,");
glColor3f(0,0,0);
drawstring(-69,-30,0.0," it needed to use its own fuel, which complicated its Mars orbit.This
impacted the spacecraft's scientific");
glColor3f(0,0,0);
drawstring(-69,-40,0.0," observations and mapping capabilities and is partly why
Mangalyaan’s scientific output has been low.");
glColor3f(0,0,0);
drawstring(-69,-50,0.0,"However, Mangalyaan's orbit does give it a great vantage point to
capture full globe views of Mars.");
glFlush();
}

6
3. Void Stars() for space simulation.

void stars()
{

glColor3f(1.0,1.0,1.0);
glPointSize(1.37);
glBegin(GL_POINTS);
glVertex2i(10,20);
glVertex2i(20,100);
glVertex2i(30,10);
glVertex2i(15,150);
glVertex2i(17,80);
glVertex2i(200,200);
glVertex2i(55,33);
glVertex2i(400,300);
glVertex2i(330,110);
glVertex2i(125,63);
glVertex2i(63,125);
glVertex2i(20,10);
glVertex2i(110,330);
glVertex2i(440,430);
glVertex2i(32,65);
glVertex2i(110,440);
glVertex2i(210,230);
glVertex2i(390,490);
glVertex2i(12,90);
glVertex2i(400,322);
glVertex2i(420,366);
glVertex2i(455,400);
glVertex2i(20,20);
glVertex2i(111,120);
glVertex2i(401,200);
glVertex2i(230,30);
glVertex2i(220,20);
glVertex2i(122,378);
glVertex2i(133,340);
glVertex2i(345,420);
glVertex2i(130,360);
glVertex2i(333,120);
glVertex2i(250,22);
glVertex2i(242,11);
glVertex2i(280,332);
glVertex2i(233,40);
glVertex2i(210,418);
7
glVertex2i(210,418);
glVertex2i(256,12);
glVertex2i(288,232);
glVertex2i(247,36);
glVertex2i(229,342);
glVertex2i(257,47);
glVertex2i(290,63);
glVertex2i(232,72);
glVertex2i(243,143);
glVertex2i(100,200);
glVertex2i(90,250);
glVertex2i(80,225);
glVertex2i(50,333);
glVertex2i(60,350);
glVertex2i(243,143);
glVertex2i(243,143);
glEnd();
}

void stars1()
{
int l;
glColor3f(1.0,1.0,1.0);
glPointSize(1.0);
glBegin(GL_POINTS);
glVertex2i(50,20);
glVertex2i(70,100);
glVertex2i(80,10);
glVertex2i(65,150);
glVertex2i(67,80);
glVertex2i(105,33);
glVertex2i(450,300);
glVertex2i(380,110);
glVertex2i(175,63);
glVertex2i(113,125);
glVertex2i(70,10);
glVertex2i(160,330);
glVertex2i(490,430);
glVertex2i(82,65);
glVertex2i(160,440);
glVertex2i(440,490);
glVertex2i(62,90);
8
glVertex2i(450,322);
glVertex2i(420,366);
glVertex2i(455,400);
glVertex2i(60,20);
glVertex2i(111,120);
glVertex2i(451,200);
glVertex2i(280,30);
glVertex2i(220,20);
glVertex2i(132,378);
glVertex2i(173,340);
glVertex2i(325,420);
glVertex2i(180,360);
glVertex2i(383,120);
glVertex2i(200,22);
glVertex2i(342,11);
glVertex2i(330,332);
glVertex2i(283,40);
glVertex2i(210,418);
glVertex2i(256,12);
glVertex2i(288,232);
glVertex2i(247,36);
glVertex2i(229,342);
glVertex2i(257,47);
glVertex2i(290,63);
glVertex2i(232,72);
glVertex2i(243,143);
glVertex2i(100,200);
glVertex2i(90,250);
glVertex2i(80,225);
glVertex2i(50,333);
glVertex2i(60,350);
glVertex2i(243,143);
glVertex2i(243,143);
glEnd();
for(l=0;l<=10000;l++)
;
}

9
4. Void rocket() to create a rocket.

void static_rocket()
{

count1++;
if(count1==150)
flag=1;
if(flag==0)
{
glClearColor(0.196078 ,0.6 ,0.8,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glColor3f(0.4,0.25,0.1);
glBegin(GL_POLYGON);
glVertex2f(0.0,0.0);
glVertex2f(0.0,250.0);
glVertex2f(270.0,250.0);
glVertex2f(500.0,50.0);
glVertex2f(500.0,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(280.0,250.0);
glVertex2f(500.0,250.0);
glVertex2f(500.0,60.0);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(260.0,250.0);
glVertex2f(290.0,250.0);
glVertex2f(500.0,70.0);
glVertex2f(500.0,40.0);
glEnd();
glColor3f(0.0,0.0,0.0);

glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);
glVertex2f(250.0,250.0);
glVertex2f(300.0,250.0);
glVertex2f(300.0,350.0);
glVertex2f(250.0,350.0);
glEnd();
glColor3f(0.7,0.7,0.7);

10
11
glBegin(GL_POLYGON);
glVertex2f(255,267.5);
glVertex2f(275.0,267.5);
glVertex2f(275.0,277.5);
glVertex2f(255.0,277.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(255,285.0);
glVertex2f(275.0,285);
glVertex2f(275.0,295);
glVertex2f(255.0,295);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(255,302.5);
glVertex2f(275.0,302.5);
glVertex2f(275.0,312.5);
glVertex2f(255.0,312.5);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(255,320.0);
glVertex2f(275.0,320.0);
glVertex2f(275.0,330.0);
glVertex2f(255.0,330.0);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(285,267.5);
glVertex2f(295.0,267.5);
glVertex2f(295.0,277.5);
glVertex2f(285.0,277.5);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(285,285.0);
glVertex2f(295.0,285);
glVertex2f(295.0,295);
glVertex2f(285.0,295);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(285,302.5);

12
glVertex2f(285,302.5);
glVertex2f(295.0,302.5);
glVertex2f(295.0,312.5);
glVertex2f(285.0,312.5);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(285,320.0);
glVertex2f(295.0,320.0);
glVertex2f(295.0,330.0);
glVertex2f(285.0,330.0);
glEnd();
glColor3f(0.647059 ,0.164706 ,0.164706);
glBegin(GL_POLYGON);
glVertex2f(26,250);
glVertex2f(52,250);
glVertex2f(39,290);
glEnd();
semicircle(20.0,50,300);

glColor3f(0.0,0.0 ,0.0);
glBegin(GL_LINES);
glVertex2f(37,313);
glVertex2f(62,310);
glVertex2f(63,287);
glVertex2f(62,310);
glEnd();
glColor3f(1.0,1.0,1.0);

glEnd();
glPointSize(2.0);

glColor3f(1.0,1.0 ,1.0);
glBegin(GL_POINTS);
glVertex2f(497,56);
glVertex2f(488,65);
glVertex2f(479,74);
glVertex2f(470,83);
glVertex2f(460,92);
glVertex2f(450,101);
glVertex2f(439,110);
glVertex2f(428,119);
glVertex2f(418,128);

13
glVertex2f(418,128);
glVertex2f(408,137);
glVertex2f(398,146);
glVertex2f(388,155);
glVertex2f(378,164);
glVertex2f(366,173);
glVertex2f(356,182);
glVertex2f(346,191);
glVertex2f(336,200);
glVertex2f(324,209);
glVertex2f(314,218);
glVertex2f(304,227);
glVertex2f(294,234);
glVertex2f(284,243);
glVertex2f(278,248);

glEnd();

glColor3f(0.0,0.0,0.0);//stand object
glBegin(GL_POLYGON);
glVertex2f(130,10.0);
glVertex2f(160,10.0);
glVertex2f(160,180.0);
glVertex2f(130,180.0);
glEnd();
glBegin(GL_LINES);
glVertex2f(130,30.0);
glVertex2f(262,30.0);

glVertex2f(130,130.0);
glVertex2f(260,130.0);
glEnd();

glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);//core
glVertex2f(237.5,20.0);
glVertex2f(262.5,20.0);
glVertex2f(262.5,120.0);
glVertex2f(237.5,120.0);
glEnd();

glColor3f(1.0,1.0,1.0);//bonnet

14
glColor3f(1.0,1.0,1.0);//bonnet
glBegin(GL_POLYGON);//front
glVertex2f(237.5,120.0);
glVertex2f(262.5,120.0);
glVertex2f(250,170.0);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//left_side_top
glVertex2f(237.5,120.0);
glVertex2f(217.5,95.0);
glVertex2f(237.5,95.0);
glEnd();
glBegin(GL_POLYGON);//left_side_bottom
glVertex2f(237.5,20.0);
glVertex2f(217.5,20.0);
glVertex2f(237.5,70.0);
glEnd();
glBegin(GL_POLYGON);//right_side_bottom
glVertex2f(262.5,20.0);
glVertex2f(282.5,20.0);
glVertex2f(262.5,70.0);
glEnd();
glBegin(GL_POLYGON);//right_side_top
glVertex2f(262.5,120.0);
glVertex2f(262.5,95.0);
glVertex2f(282.5,95.0);
glEnd();
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);//bottom_1_exhaust
glVertex2f(237.5,20.0);
glVertex2f(244.5,20.0);
glVertex2f(241,0.0);
glEnd();
glBegin(GL_POLYGON);//bottom_2_exhaust
glVertex2f(246.5,20.0);
glVertex2f(253.5,20.0);
glVertex2f(249.5,0.0);
glEnd();
glBegin(GL_POLYGON);//bottom_3_exhaust
glVertex2f(262.5,20.0);
glVertex2f(255.5,20.0);
glVertex2f(258.5,0.0);
glEnd();

15
glEnd();

glBegin(GL_POLYGON);//left_stand_holder
glVertex2f(182.5,85.0);
glVertex2f(182.5,0.0);
glVertex2f(187.5,0.0);
glVertex2f(187.5,80.0);
glVertex2f(237.5,80.0);
glVertex2f(237.5,85.0);
glVertex2f(182.5,85.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(312.5,85.0);//right_stand_holder
glVertex2f(312.5,0.0);
glVertex2f(307.5,0.0);
glVertex2f(307.5,80.0);
glVertex2f(262.5,80.0);
glVertex2f(262.5,85.0);
glVertex2f(312.5,85.0);
glEnd();

for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}

16
5. Void Rocket_to_cam_pos() for front view.
void rocket_to_cam_pos()
{
count++;
count3++;

for(i=0;i<=200;i++)
{

glClearColor(0.196078 ,0.6 ,0.8,1.0);


glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);//core
glVertex2f(237.5,20.0+i);
glVertex2f(262.5,20.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(237.5,120.0+i);

glEnd();

glColor3f(1.0,1.0,1.0);//bonnet
glBegin(GL_POLYGON);//front
glVertex2f(237.5,120.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(250,170.0+i);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//left_side_top
glVertex2f(237.5,120.0+i);
glVertex2f(217.5,95.0+i);
glVertex2f(237.5,95.0+i);
glEnd();
glBegin(GL_POLYGON);//left_side_bottom
glVertex2f(237.5,20.0+i);
glVertex2f(217.5,20.0+i);
glVertex2f(237.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);//right_side_bottom
glVertex2f(262.5,20.0+i);
glVertex2f(282.5,20.0+i);
glVertex2f(262.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);//right_side_top
17
glBegin(GL_POLYGON);//right_side_top
glVertex2f(262.5,120.0+i);
glVertex2f(262.5,95.0+i);
glVertex2f(282.5,95.0+i);
glEnd();
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);//bottom_1_exhaust
glVertex2f(237.5,20.0+i);
glVertex2f(244.5,20.0+i);
glVertex2f(241,0.0+i);
glEnd();
glBegin(GL_POLYGON);//bottom_2_exhaust
glVertex2f(246.5,20.0+i);
glVertex2f(253.5,20.0+i);
glVertex2f(249.5,0.0+i);
glEnd();
glBegin(GL_POLYGON);//bottom_3_exhaust
glVertex2f(262.5,20.0+i);
glVertex2f(255.5,20.0+i);
glVertex2f(258.5,0.0+i);
glEnd();

if((p%2)==0)
glColor3f(1.0,0.25,0.0);
else
glColor3f(1.0,0.816,0.0);

glBegin(GL_POLYGON);//outer fume
glVertex2f(237.5,20+i);
glVertex2f(234.16,16.66+i);
glVertex2f(230.82,13.32+i);
glVertex2f(227.48,9.98+i);
glVertex2f(224.14,6.64+i);
glVertex2f(220.8,3.3+i);
glVertex2f(217.5,0+i);
glVertex2f(221.56,-5+i);
glVertex2f(225.62,-10+i);
glVertex2f(229.68,-15+i);
glVertex2f(233.74,-20+i);
glVertex2f(237.8,-25+i);
glVertex2f(241.86,-30+i);
glVertex2f(245.92,-35+i);
glVertex2f(250,-40+i);
glVertex2f(254.06,-35+i);
18
glVertex2f(254.06,-35+i);
glVertex2f(258.12,-30+i);
glVertex2f(262.18,-25+i);
glVertex2f(266.24,-20+i);
glVertex2f(270.3,-15+i);
glVertex2f(274.36,-10+i);
glVertex2f(278.42,-5+i);
glVertex2f(282.5,0+i);
glVertex2f(278.5,4+i);
glVertex2f(274.5,8+i);
glVertex2f(270.5,12+i);
glVertex2f(266.5,16+i);
glVertex2f(262.5,20+i);//28 points
glEnd();

if((p%2)==0)
glColor3f(1.0,0.816,0.0);
else
glColor3f(1.0,0.25,0.0);

glBegin(GL_POLYGON);//inner fume
glVertex2f(237.5,20+i);
glVertex2f(236.5,17.5+i);
glVertex2f(235.5,15+i);
glVertex2f(234.5,12.5+i);
glVertex2f(233.5,10+i);
glVertex2f(232.5,7.5+i);
glVertex2f(236,5+i);
glVertex2f(239.5,2.5+i);
glVertex2f(243,0+i);
glVertex2f(246.5,-2.5+i);
glVertex2f(250,-5+i);
glVertex2f(253.5,-2.5+i);
glVertex2f(257,0+i);
glVertex2f(260.5,2.5+i);
glVertex2f(264,5+i);
glVertex2f(267.5,7.5+i);
glVertex2f(266.5,10+i);
glVertex2f(265.5,12.5+i);
glVertex2f(264.5,15+i);
glVertex2f(263.5,17.5+i);
glVertex2f(262.5,20+i);//21 points

glEnd();

19
glEnd();
p=p+1;
for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
}

20
6. void rocket_in_motion() for rocket movement.
void rocket_in_motion()
{
count++;

for(i=195;i<=200;i++)
{
if(count>=5)
{
glClearColor(0.0 ,0.0 ,0.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
if(flag1==0)
{
stars();
flag1=1;
}
else
{
stars1();

flag1=0;
}

}
else
{
glClearColor(0.196078 ,0.6 ,0.8,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
if(count>=100)
mars(20.0);

if(count<=130){
glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);//core
glVertex2f(237.5,20.0+i);
glVertex2f(262.5,20.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(237.5,120.0+i);
glEnd();
}

if(count>=150){
static int k = i;
21
static int k = i;
glColor3f(1.0,1.0,1.0);//satellite
glBegin(GL_POLYGON);//core
glVertex2f(237.5,150.0+k);
glVertex2f(252.5,150.0+k);
glVertex2f(252.5,120.0+k);
glVertex2f(237.5,120.0+k);
glEnd();

glBegin(GL_POLYGON);//side-panels
glVertex2f(237.5,140.0+k);
glVertex2f(230,140.0+k);
glVertex2f(230,130.0+k);
glVertex2f(237.5,130.0+k);

glVertex2f(262.5,140.0+k);
glVertex2f(227.5,140.0+k);
glVertex2f(227.5,130.0+k);
glVertex2f(262.5,130.0+k);
glEnd();
}

else{
glColor3f(1.0,1.0,1.0);//bonnet
glBegin(GL_POLYGON);//front
glVertex2f(237.5,120.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(250,170.0+i);
glEnd();
}

if(count<=120){
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//left_side_top
glVertex2f(237.5,120.0+i);
glVertex2f(217.5,95.0+i);
glVertex2f(237.5,95.0+i);
glEnd();
glBegin(GL_POLYGON);//left_side_bottom
glVertex2f(237.5,20.0+i);
glVertex2f(217.5,20.0+i);
glVertex2f(237.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);//right_side_bottom

22
glBegin(GL_POLYGON);//right_side_bottom
glVertex2f(262.5,20.0+i);
glVertex2f(282.5,20.0+i);
glVertex2f(262.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);//right_side_top
glVertex2f(262.5,120.0+i);
glVertex2f(262.5,95.0+i);
glVertex2f(282.5,95.0+i);
glEnd();
}

if(count<=110){
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);//bottom_1_exhaust
glVertex2f(237.5,20.0+i);
glVertex2f(244.5,20.0+i);
glVertex2f(241,0.0+i);
glEnd();
glBegin(GL_POLYGON);//bottom_2_exhaust
glVertex2f(246.5,20.0+i);
glVertex2f(253.5,20.0+i);
glVertex2f(249.5,0.0+i);
glEnd();
glBegin(GL_POLYGON);//bottom_3_exhaust
glVertex2f(262.5,20.0+i);
glVertex2f(255.5,20.0+i);
glVertex2f(258.5,0.0+i);
glEnd();
}

for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
}glEnd();
p=p+1;
for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();}
}
23
7. void mars(float radius) for creating mars.
void mars(float radius)
{

glBegin(GL_POLYGON);

for (int i=0; i<=359; i++)


{
float degInRad = i*DEG2RAD;
glVertex2f(300+f+cos(degInRad)*radius,500-t+(sin(degInRad))

*radius);//100,100 specifies centre of the circle


}

glEnd();
t=t+0.1;
f=f+0.1;
}

//keys that trigger manual Lanch


void keyboard(unsigned char key, int x, int y)
{
if (key == 'S' || key == 's'){
for(int i=0;i<100;i++)
static_rocket();
flag = 1;

if (key == 'L' || key == 'l')


{
for(int i=0;i<100;i++)
static_rocket();
}

if (key == 'Q' || key == 'q')


exit(0);

//design of homescreen
void page()
glColor3f(1, 1, 1);

24
{
glColor3f(1, 1, 1);
glLineWidth(5);
glBegin(GL_LINE_LOOP);
glVertex2d(75, 425);
glVertex2d(375, 425);
glVertex2d(375, 325);
glVertex2d(75, 325);
glEnd();

drawstring(100, 400, "ROCKET LAUNCHING SIMULATION");


drawstring(100, 380, "NAME : pankaj kumar");
drawstring(100, 360, "USN : 4nm19cs125");
drawstring(100, 340, "NAME : p kushal");
drawstring(100, 330, "USN : 4nm19cs124");

glBegin(GL_LINE_LOOP);
glVertex2d(75, 75);
glVertex2d(375, 75);
glVertex2d(375, 225);
glVertex2d(75, 225);
glEnd();

drawstring(100, 200, "INSTRUCTIONS");


drawstring(100, 180, "Press S to START");
drawstring(100, 160, "Press L to Launch Pad");
drawstring(100, 100, "Press Q to quit");
glFlush();
}

//display all components


void display()
{
if (flag == 0)
{
glClear(GL_COLOR_BUFFER_BIT);
page();
glutSwapBuffers();
}
else
control();
glFlush();
}

25
8. Void init() and the main() Function.
void myinit()
{
//int i;
glClearColor(0.196078 ,0.6 ,0.8,1.0);

glPointSize(1.0);
gluOrtho2D(0.0,499.0,0.0,499.0);
}

int main(int argc,char*argv[])


{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(600,600);
glutCreateWindow("rocket");
myinit();
glutKeyboardFunc(keyboard);
glutDisplayFunc(display);
glutIdleFunc(display);

glutMainLoop();
return 0;
}

26
CONCLUSION:
In this project we have demonstrated the MOM mission simulation. There is an
external journey view . The rocket, the satellite and stars are functional. We have
shown the PSLV launch and then the detachment of the satellite from the rocket
and entering near the mars orbit.

OpenGL supports enormous flexibility in 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. We have implemented the project making it user-friendly and error free
as possible.

27
REFERENCES:
 https://docs.microsoft.com/en-us/windows/win32/opengl/gl-functions
 https://www.opengl.org/resources/libraries/glut/spec3/spec3.html
 https://lazyfoo.net/tutorials/OpenGL/index.php

28
APPENDIX:

Figure 1: Introductory page - Name USN

Figure 2: Some basic information about the Mars Orbiter Mission.

29
Figure 3: OpenGL opening page.

Figure 4: First rocket view on pressing S.

30
Figure 5: Movement of PSLV toward mars.

Figure 6: Rocket nears mars.

31
Figure 7: Rocket parts detachment starts.

Figure 8: The detached satellite now separates and is ready for sending
surface pictures of Mars.

32

You might also like