Solar Reports
Solar Reports
CHAPTER 1
INTRODUCTION
1.1 Computer Graphics
Graphics provides one of the most natural means of communicating with a computer, since
our highly developed 2D and 3D pattern recognition abilities allow us to perceive and process
pictorial data rapidly and efficiently. Interactive computer graphics is the most important means of
producing pictures since the invention of photography and television. It has the added advantage
that, with the computer, we can make pictures not only of concrete real world objects but also of
abstract, synthetic objects, such as mathematical surfaces and of data that have no inherent
geometry, such as survey results.
1.2 OpenGL
1|Page
[Document title]
OpenGL has historically been influential on the development of 3D accelerator, promoting a base
level of functionality that is now common in consumer level hardware:
➢ Rasterized points, lines and polygons are basic primitives.
➢ A transform and lighting pipeline .
➢ Z buffering .
➢ Texture Mapping.
➢ Alpha Blending.
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.
2|Page
[Document title]
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 your 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.
➢ Pixel Operation:
While geometric data takes one path through the OpenGL rendering pipeline, pixel data takes
a different route. Pixels from an array in system memory are first unpacked from one of a variety
of formats into the proper number of components. Next the data is scaled, biased, and processed
by a pixel map. The results are clamped and then either written into texture memory or sent to the
rasterization step.
➢ Rasterization:
Rasterization is the conversion of both geometric and pixel data into fragments. Each fragment
square corresponds to a pixel in the framebuffer. Color and depth values are assigned for each
fragment square.
➢ Fragment Operations :
Before values are actually stored into the framebuffer, a series of operations are performed that
may alter or even throw out fragments. All these operations can be enabled or disabled.
3|Page
[Document title]
1.4 Scope
It is developed in ECLIPSE. It has been implemented on UBUNTU platform. The 3-D
graphics package designed here provides an interface for the users for handling the display and
manipulation of Celestial Exploratory. The Keyboard is the main input device used.
4|Page
[Document title]
CHAPTER 2
LITERATURE SURVEY
The Solar System consists of the Sun and objects bound by gravity, including eight
planets. The inner four terrestrial planets—Mercury, Venus, Earth, and Mars—are
rocky, while the outer four gas giants—Jupiter, Saturn, Uranus, and Neptune—are
much larger and composed mostly of gases and ices. The Sun, a G2 yellow dwarf,
dominates the system with 99.86% of its mass.
Mercury, the closest planet, has no moons and is characterized by extreme
temperature variations. Venus, similar in size to Earth, has a dense atmosphere and
extreme heat. Earth is the only planet known to support life, with liquid water and
geological activity. Mars, with a thin atmosphere, has geological features like
volcanoes and valleys and two small moons.
Jupiter, the largest planet, has a strong atmosphere with features like the Great Red
Spot and 63 moons, including Ganymede. Saturn, famous for its rings, is the least
dense planet and has 62 moons, including Titan. Uranus, with a unique sideways
tilt, has 27 moons. Neptune, more massive than Uranus, has 13 moons, with Triton
being geologically active.
The Solar System also contains the asteroid belt and Kuiper belt, home to smaller
objects.
5|Page
[Document title]
CHAPTER 3
REQUIREMENT SPECIFICATION
• 110 MB of hard disk space required, 40 MB additional hard disk space required for
installation (150 MB total).
6|Page
[Document title]
CHAPTER 4
DESIGN
The project “CELESTIAL EXPLORATORY” is meant as a source of recreation where one
can sit in front of the computer and have the vision of a plant in space. This package is developed
to provide opportunities to climb aboard the earth for the adventure of the lifetime. It is aimed to
create starts and planets and give constant motion to these objects.
The sun and its family of eight planets are imagined to be placed in a background of bright
twinkling starts along with a comet in constant motion.
The lighting effect in the background appears as though the planet is rotating and revolving around
the sun in the galaxy. The most important aspect of this project is that ,one can sit back ,relax and
watch constantly occurring motion of the planet and the stars just depicting the fact that “as
passengers of the earth our voyage never ends!”
1. glClearColor(. . . ):
Whenever we wish to draw a new frame,the window must be cleared by using the
4-dimensional(RGBA)color system.The above function must be enabled to make
the window on screen solid and white.
2. glshadeModel(. . .):
The z_buffer is one of the buffers that make up the frame buffer.The depth buffer must
be cleared whenever we wish to redraw the display.This is done as follows
glEnable(GL_DEPTH_TEST);
4. glMaterial(. . .):
We can specify different material properties for the front and back faces of a surface
through the following functions glMaterialfv(GLenum face, GLenum type,GLfloat
*pointer_to_array); glMaterialfv(GLenum face,GLenum type,GLfloat value);
5. glLight(. . .):
7|Page
[Document title]
This function is used to enable a light source.The following function specifies the required
vector and scalar parameters to enable a light source.
glLightfv(GLenum source,GLenum parameter,GLfloat*pointer_to_arrary))
glLightf(GLenum source,GLenum parameter,GLfloat value)
6. glColorMaterial(. . .):
myinit();
Here we initialize the color buffer, set the point size and set window co-ordinate
values.
display();
This function creates and translates all the objects in a specified locatioN in a particular
order.
Translated(. . .);
In this function the variables are components of displacement vector.
glutPostRedisplay();
It ensures that display will be drawn only once each time program goes through the
event loop.
glutMainLoop();
This function whose execution will cause the program to begin an event processing loop.
User Interface:
Keyboard Based Interface
Using the keyboard user can make the planets to rotate on their own axis and revolve round the
Sun. The stars are made to twinkle and the Comet is made to revolve round the Sun.
1. The keys m, v, e, r, j, s, u, n are used to rotate the planets.
8|Page
[Document title]
2. The keys M, V, E, R, J, S, U, N are used to revolve the planets around the Sun.
3. The key z rotates the sun, B gives both the rotation and revolution of the planets around the rotating
Sun with a Comet revolution and Stars twinkle.
4. Pressing the key A revolves all the planets and comet and the key a rotates all the planets around
the rotating Sun with Stars twinkling in the background.
5. The key b is used to make the stars twinkle and c for the revolution of the Comet.
Mouse Interface
Using the mouse user can make the planets to rotate and revolve round the Sun and
Comet to revolve round the Sun.
Left Button: Rotates and revolves the planets and Comet in anticlockwise direction.
Middle Button: Rotates and revolves the planets and Comet in clockwise direction.
Right Button: Rotates and revolves the planets and Comet in clockwise direction.
9|Page
[Document title]
CHAPTER 5
IMPLEMENTATION
The implementation of the different objects in this project is divided into different module.
MODULE 1:
SUN:
The sun is drawn by using the following lines of code.
{ glPushMatrix(); glRotatef(…);
glLightfv(GL_LIGHT0,GL_POSITION,position);
glDisable(GL_LIGHTING); glutSolidSphere(…);
glPopMatrix();
}
MODULE 2:
PLANETS WITH RINGS:
The planets Saturn and Uranus are the 2 planets in our solar system with rings. They are
implemented using the following codes.
{ glPushMatrix(); glRotatef(…);
glTranslatef(…);
gluLookAt(0.0,10.0,2.0,1.0,0.0,0.0,0.0,0.0,1.0);
glutSolidSphere(…); int i=0;
glBegin(GL_QUAD_STRIP); for(i=0;i<=360;i++)
{
glVertex3f(sin(i*3.1416/180)*0.5,cos(i*3.1416/180)*0.5,0);
glVertex3f(sin(i*3.1416/180)*0.7,cos(i*3.1416/180)*0.7,0); } glEnd(); glPopMatrix();
}
MODULE 3:
EARTH:
The earth is drawn along with its natural satellite, moon which revolve round the earth. The
following lines of codes are used to implement the earth and the moon.
{ glPushMatrix(); glRotatef(…);
glTranslatef(…); glRotatef(…);
10 | P a g e
[Document title]
glColor3f(…); glutSolidSphere(…);
/*draw planet earth*/ glRotatef(…);
glTranslatef(…); glColor3f(…);
glutSolidSphere(…); /*draw moon*/
glPopMatrix();
}
MODULE 4:
OTHER PLANETS:
The remaining planets are Mercury, Venus, Mars, Jupiter and Neptune. All these planets are
implemented using the same set of codes by changing the values and colors.
{ glPushMatrix();
glRotatef(…);
glTranslatef(…);
glRotatef(…);
glColor3f(…);
glutSolidSphere(
…); /*draw
smaller planet
mercury*/
glPopMatrix();
}
MODULE 5:
STARS:
The stars are implemented in the background using the following lines of codes.
{ glPushMatrix(); glTranslatef(…);
gluLookAt(0.0,10.0,0.0,1.0,0.0,0.0,0.0,0.0,3.0);
glRotatef(…); glScalef(…); glColor3f(…);
glutSolidSphere(…); glPopMatrix();
}
11 | P a g e
[Document title]
CHAPTER 6
SNAPSHOTS
12 | P a g e
[Document title]
In this snapshot, we can see sun at the center and all eight planets Revolving around the
sun and are placed in the background of bright twinkling stars with the comet in a constant
motion
In this snapshot ,sun is placed at the center and its eight planets are placed in the sun’s orbit.
These eight planets are shown to be rotating around the sun .the planets and sun are placed in
The background of bright twinkling stars and we can also see the comet passing through these
planets andsun with constant motion
13 | P a g e
[Document title]
CHAPTER 7
CONCLUSION
The code we have implemented for our project is working well to the best of our
knowledge.
In this project the planets, sun, comet and starts act as per the users’s command.This
project will serve as a delight to the eyes of the night sky watchers.
This project is both informative and entertaining . This project provided an opportunity
to learn the various concepts of the subject in detail and provided us a platform to express our
creativity and imagination come true.
It can be concluded that the project “Celestial Exploratory” is a thing of beauty that will remain
a joy forever in our hearts.
14 | P a g e
[Document title]
#include<stdlib.h>
#include<GL/glut.h>
#include<math.h>
=0,c=0;
void myinit(void)
{ glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT,GL_DIFFUSE,diffuseMaterial);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialf(GL_FRONT,GL_SHININESS,25.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glColorMaterial(GL_FRONT,GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
void display(void)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1.0,0.5,0.0);
glPushMatrix();
15 | P a g e
[Document title]
glRotatef((GLfloat)z,1.0,1.0,1.0);
glLightfv(GL_LIGHT0,GL_POSITION,position);
glDisable(GL_LIGHTING);
glPushMatrix();
glLightfv(GL_LIGHT0,GL_POSITION,position);
glDisable(GL_LIGHTING);
glEnable(GL_LIGHTING);
glColor3f(1.5,0.5,0.0);
glutSolidTorus(0.2,0.9,6,20);
glPopMatrix();
glPushMatrix();
glRotatef((GLfloat)M,0.0,1.0,0.0);
glTranslatef(1.5,0.0,0.0);
glRotatef((GLfloat)m,0.0,1.0,0.0);
glColor3f(1.0,0.0,0.0);
glPushMatrix();
glRotatef((GLfloat)V,0.0,1.0,0.0);
glTranslatef(2.0,0.0,1.0);
glRotatef((GLfloat)v,0.0,1.0,0.0);
glColor3f(7.5,9.5,1.0);
glPushMatrix();
glRotatef((GLfloat)E,0.0,1.0,0.0);
glTranslatef(3.5,0.0,0.0);
glRotatef((GLfloat)e,0.0,1.0,0.0);
glColor3f(0.1,6.5,2.0);
16 | P a g e
[Document title]
glTranslatef(0.3,0.2,0.0);
glColor3f(4.3,3.5,8.0);
glPushMatrix();
glRotatef((GLfloat)R,0.0,1.0,0.0);
glTranslatef(5.0,0.0,3.0);
glRotatef((GLfloat)r,0.0,1.0,0.0);
glColor3f(1.0,0.2,0.0);
glPushMatrix();
glRotatef((GLfloat)J,0.0,1.0,0.0);
glTranslatef(-2.5,0.0,1.0);
glRotatef((GLfloat)j,0.0,1.0,0.0);
glColor3f(0.9,0.7,0.3);
glPushMatrix();
glRotatef((GLfloat)S,0.0,1.0,0.0);
glTranslatef(-5.0,0.0,0.0);
gluLookAt(0.0,10.0,2.0,1.0,0.0,0.0,0.0,0.0,1.0);
glRotatef((GLfloat)s,0.0,0.0,5.0);
glColor3f(4.5,0.5,0.0);
glBegin(GL_QUAD_STRIP);
{ glVertex3f(sin(i*3.1416/180)*0.5,cos(i*3.1416/180)*0.5,0);
glVertex3f(sin(i*3.1416/180)*0.7,cos(i*3.1416/180)*0.7,0);
glEnd();
glPopMatrix();
glPushMatrix();
17 | P a g e
[Document title]
{ glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
myinit();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
return 0;
18 | P a g e