0% found this document useful (0 votes)
17 views19 pages

Solar Reports

this is an Computer graphics mini project report

Uploaded by

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

Solar Reports

this is an Computer graphics mini project report

Uploaded by

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

[Document title]

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

OpenGL (Open Graphics Library) is a standard specification defining a cross language


cross platform API for writing applications that produce 2D and 3D computer graphics. The
interface consists of over 250 different function calls which can be used to draw complex 3D scenes
from simple primitives. OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992 and is
widely used in CAD, virtual reality, scientific visualization, information visualization and flight
simulation. It is also used in video games, where it competes with direct 3D on Microsoft Windows
Platforms. OpenGL is managed by the non profit technology consortium, the Khronos group Inc.

OpenGL serves two main purposes :


➢ To hide the complexities of interfacing with different 3D accelerators, by
presenting programmer with a single, uniform API
➢ To hide the differing capabilities of hardware platforms , by requiring that all
implementations support the full OpenGL feature set.

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.

1.2.1 OpenGL Graphics Architecture :

Figure 1.1 Opengl Graphics Architecture

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]

➢ 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 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.3 Project Goal


The aim of this project is to show the shadow implementation using OPENGL which
include Movement, Light properties also transformation operations like translation, rotation,
scaling etc on objects. The package must also have a user friendly interface .

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

3.1 HARDWARE REQUIREMENTS:

• 128 MB of RAM, 256 MB recommended.

• 110 MB of hard disk space required, 40 MB additional hard disk space required for
installation (150 MB total).

3.2 SOFTWARE REQUIREMENTS:


This solar system simulator has been designed for UBUNTU. OpenGL libraries are used
and hence ECLIPSE is required.

Development Platform: LINUX (UBUNTU 10.4)


Language :C
Tool : Eclipse
Library : OpenGL

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(. . .):

To enable the smooth shading we must set the shade as follows


glShadeModel(GL_SMOOTH);
3. glEnable(. . .):

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(. . .):

This function is used to change a single material property.

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

Fig 6.1 Solar system with revolution of mercury


Here we can see the sun at the center and all planets revolving
around the sun.In this we have mainly highlighted planet mercury revolving around the sun.It
appears dark because the light is falling on the front face of the planet mercury but the viewer is
viewing the back face.

Fig 6.2 Solar system with revolution of planets and comet

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

Fig 6.3 Sun ,twinkling stars and comet


In this snapshot we can the sun that is imagined to be placed at the center and is also olaced in
the background of bright twinkling stars and the comet passing with a constant motion through
the sun from the left bottom end to right top end

Fig 6.5 Final


view of solar system

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]

APPENDIX A- SOURCE CODE


#include<stdio.h>

#include<stdlib.h>

#include<GL/glut.h>

#include<math.h>

static int m=0,M=0,v=0,V=0,E=0,e=0,r=0,R=0,j=0,J=0,s=0,S=0,U=0,u=0,n=0,N=0,X=0,z=0,B=0,b

=0,c=0;

static GLint axis=2;

GLfloat diffuseMaterial[4]= {0.5,0.5,0.5,1.0};

/*initialize material property,light soure,lighting model,and depth buffer*/

void myinit(void)

{ glClearColor(0.0,0.0,0.0,0.0);

glShadeModel(GL_SMOOTH);

glEnable(GL_DEPTH_TEST);

GLfloat mat_specular[]= {1.0,1.0,1.0,1.0};

GLfloat light_position[]= {1.0,1.0,1.0,0.0};

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)

GLfloat position[]= {0.0,0.0,1.5,1.0};

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);

glutSolidSphere(0.8,40,16); /*draw sun*/ glPopMatrix();

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);

glutSolidSphere(0.2,20,8); /*draw smaller planet mercury*/ glPopMatrix();

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);

glutSolidSphere(0.2,20,8); /*draw smaller plant venus*/ glPopMatrix();

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);

glutSolidSphere(0.2,20,8); /*draw smaller plant earth*/ glRotatef((GLfloat)X,0.0,1.0,0.0);

16 | P a g e
[Document title]

glTranslatef(0.3,0.2,0.0);

glColor3f(4.3,3.5,8.0);

glutSolidSphere(0.1,20,14); /*draw moon*/ glPopMatrix();

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);

glutSolidSphere(0.2,20,8); /*draw smaller planet mars*/ glPopMatrix();

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);

glutSolidSphere(0.2,20,8);/*draw smaller planet Jupiter*/ glPopMatrix();

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);

glutSolidSphere(0.5,20,16); /*draw smaller plant Saturn*/ 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();

glPushMatrix();

glRotatef ((GLfloat) U, 0.0, 1.0,0.0);

glTranslatef (-6.5, 0.0, 0.0);

17 | P a g e
[Document title]

int main(int argc,char **argv)

{ glutInit(&argc,argv);

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);

glutInitWindowSize(500,500);

glutInitWindowPosition(100,100);

glutCreateWindow("planets amidst stars");

myinit();

glutDisplayFunc(display);

glutReshapeFunc(reshape);

glutKeyboardFunc(keyboard);

glutMouseFunc(mouse);

glEnable(GL_DEPTH_TEST);

glutMainLoop();

return 0;

18 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy