You are on page 1of 39

[Type the document title]

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM, KARNATAKA

A MINI PROJECT REPORT ON

REFLECTING DINO

A report submitted in partial fulfillment of the requirements for the

MINI PROJECT OF COMPUTER GRAPHCIS AND VISUALIZATION


LAB (10CSL67)

Submitted by
MONICA SB(3BR12CS054)

MONIKA C(3BR12CS055)

TAMEEM K(3BR12CS117)

[Type text] Page 1


[Type the document title]

Under the guidance of

Prof.JAGADISH R MB.E.,M.Tech,

Prof. AZHAR BAIGMB.E.,M.Tech

Department of CSE, BITM, Bellary.

[Type text] Page 2


[Type the document title]
BASAVARAJESWARI GROUP OF INSTITUTIONS

BALLARI INSTITUTE OF TECHNOLOGY & MANAGEMENT


NBA Accredited Institution*
(Recognized by Govt. of Karnataka, approved by AICTE, New Delhi & Affiliated to
Visvesvaraya Technological University, Belgaum)
"JnanaGangotri" Campus, No.873/2, Bellary-Hospet Road, Allipur,
Bellary-583 104 (Karnataka) (India)
Ph: 08392 237100 / 237190, Fax: 08392 - 237197

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

Certified that the mini project work entitled REFLECTING DINOcarried


outby MONICA SBbearing USN 3BR12CS054,MONIKA Cbearing
USN3BR12CS055,TAMEEM K bearing USN 3BR12CS117 a bonafide
student of Ballari institute of technology and management, in partial
fulfillment of the requirements for the mini project ofComputer Graphcis
And Visualization Lab (10CLl67)of theVisvesvaraya Technological
University, Belgaum during the year 2014-2015. It is certified that all
corrections/suggestions indicated for internal assessment have been
incorporated. The report has been approved as it satisfies the academic
requirements in respect of mini project work prescribed for the VIth
semester.

Signature of the project guide Signature of the HOD

[Type text] Page 3


[Type the document title]

1.Prof. Jagadish RMB.E.,M.Tech Dr.R N


kulakarniB.E., M.Tech.,Ph.D

2.Prof. Azhar Baig MB.E., M.Tech

External viva
Name of the Examiners Signature with date

1.

2.
VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM, KARNATAKA

A MINI PROJECT REPORT ON

REFLECTING DINO

A report submitted in partial fulfillment of the requirements for the

[Type text] Page 4


[Type the document title]

MINI PROJECT OF COMPUTER GRAPHCIS AND VISUALIZATION


LAB (10CSL67)

Submitted by
MONICA SB(3BR12CS054)

MONIKA C(3BR12CS055)

TAMEEM K(3BR12CS117)

Under the guidance of

Prof.JAGADISH R MB.E.,M.Tech,

Prof. AZHAR BAIGMB.E.,M.Tech

Department of CSE, BITM, Bellary.

[Type text] Page 5


[Type the document title]
BASAVARAJESWARI GROUP OF INSTITUTIONS

BALLARI INSTITUTE OF TECHNOLOGY & MANAGEMENT


NBA Accredited Institution*
(Recognized by Govt. of Karnataka, approved by AICTE, New Delhi & Affiliated to
Visvesvaraya Technological University, Belgaum)
"JnanaGangotri" Campus, No.873/2, Bellary-Hospet Road, Allipur,
Bellary-583 104 (Karnataka) (India)
Ph: 08392 237100 / 237190, Fax: 08392 - 237197

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

Certified that the mini project work entitled REFLECTING DINOcarried


outby MONICA SBbearing USN 3BR12CS054,MONIKA Cbearing
USN3BR12CS055,TAMEEM K bearing USN 3BR12CS117 a bonafide
student of Ballari institute of technology and management, in partial
fulfillment of the requirements for the mini project ofComputer Graphcis
And Visualization Lab (10CLl67)of theVisvesvaraya Technological
University, Belgaum during the year 2014-2015. It is certified that all
corrections/suggestions indicated for internal assessment have been
incorporated. The report has been approved as it satisfies the academic
requirements in respect of mini project work prescribed for the VIth
semester.

Signature of the project guide Signature of the HOD

[Type text] Page 6


[Type the document title]

1.Prof. Jagadish RMB.E.,M.Tech Dr.R N


kulakarniB.E., M.Tech.,Ph.D

2.Prof. Azhar Baig MB.E., M.Tech

External viva
Name of the Examiners Signature with date

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM, KARNATAKA

A MINI PROJECT REPORT ON

REFLECTING DINO

[Type text] Page 7


[Type the document title]

A report submitted in partial fulfillment of the requirements for the

MINI PROJECT OF COMPUTER GRAPHCIS AND VISUALIZATION


LAB (10CSL67)

Submitted by
MONICA SB(3BR12CS054)

MONIKA C(3BR12CS055)

TAMEEM K(3BR12CS117)

Under the guidance of

Prof.JAGADISH R MB.E.,M.Tech,

Prof. AZHAR BAIGMB.E.,M.Tech

Department of CSE, BITM, Bellary.

[Type text] Page 8


[Type the document title]
BASAVARAJESWARI GROUP OF INSTITUTIONS

BALLARI INSTITUTE OF TECHNOLOGY & MANAGEMENT


NBA Accredited Institution*
(Recognized by Govt. of Karnataka, approved by AICTE, New Delhi & Affiliated to
Visvesvaraya Technological University, Belgaum)
"JnanaGangotri" Campus, No.873/2, Bellary-Hospet Road, Allipur,
Bellary-583 104 (Karnataka) (India)
Ph: 08392 237100 / 237190, Fax: 08392 - 237197

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

Certified that the mini project work entitled REFLECTING DINOcarried


outby MONICA SBbearing USN 3BR12CS054,MONIKA Cbearing
USN3BR12CS055,TAMEEM K bearing USN 3BR12CS117 a bonafide
student of Ballari institute of technology and management, in partial
fulfillment of the requirements for the mini project ofComputer Graphcis
And Visualization Lab (10CLl67)of theVisvesvaraya Technological
University, Belgaum during the year 2014-2015. It is certified that all
corrections/suggestions indicated for internal assessment have been
incorporated. The report has been approved as it satisfies the academic
requirements in respect of mini project work prescribed for the VIth
semester.

Signature of the project guide Signature of the HOD

[Type text] Page 9


[Type the document title]

1.Prof. Jagadish RMB.E.,M.Tech Dr.R N


kulakarniB.E., M.Tech.,Ph.D

2.Prof. Azhar Baig MB.E., M.Tech

External viva
Name of the Examiners Signature with date

1.

2.
VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM, KARNATAKA

A MINI PROJECT REPORT ON

REFLECTING DINO

A report submitted in partial fulfillment of the requirements for the

[Type text] Page 10


[Type the document title]

MINI PROJECT OF COMPUTER GRAPHCIS AND VISUALIZATION


LAB (10CSL67)

Submitted by
MONICA SB(3BR12CS054)

MONIKA C(3BR12CS055)

TAMEEM K(3BR12CS117)

Under the guidance of

Prof.JAGADISH R MB.E.,M.Tech,

Prof. AZHAR BAIGMB.E.,M.Tech

Department of CSE, BITM, Bellary.

[Type text] Page 11


[Type the document title]
BASAVARAJESWARI GROUP OF INSTITUTIONS

BALLARI INSTITUTE OF TECHNOLOGY & MANAGEMENT


NBA Accredited Institution*
(Recognized by Govt. of Karnataka, approved by AICTE, New Delhi & Affiliated to
Visvesvaraya Technological University, Belgaum)
"JnanaGangotri" Campus, No.873/2, Bellary-Hospet Road, Allipur,
Bellary-583 104 (Karnataka) (India)
Ph: 08392 237100 / 237190, Fax: 08392 - 237197

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

Certified that the mini project work entitled REFLECTING DINOcarried


outby MONICA SBbearing USN 3BR12CS054,MONIKA Cbearing
USN3BR12CS055,TAMEEM K bearing USN 3BR12CS117 a bonafide
student of Ballari institute of technology and management, in partial
fulfillment of the requirements for the mini project ofComputer Graphcis
And Visualization Lab (10CLl67)of theVisvesvaraya Technological
University, Belgaum during the year 2014-2015. It is certified that all
corrections/suggestions indicated for internal assessment have been
incorporated. The report has been approved as it satisfies the academic
requirements in respect of mini project work prescribed for the VIth
semester.

Signature of the project guide Signature of the HOD

[Type text] Page 12


[Type the document title]

1.Prof. Jagadish RMB.E.,M.Tech Dr.R N


kulakarniB.E., M.Tech.,Ph.D

2.Prof. Azhar Baig MB.E., M.Tech

External viva
Name of the Examiners Signature with date

1.

2.

ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any
project would be incomplete without mentioning the people who made it possible,
whose constant guidance and encouragements crowned my efforts with success.
We take this opportunity to express the deepest gratitude and appreciation to all
those held me directly or indirectly towards the successful completion of the project.

It is indeed great pleasure and privilege for me to meet this project report. We wish
to take opportunity to pay my profound gratefulness and express my indebtedness
to my guideJAGADISH.R.M andAZHAR BAIG.M,for his keen interest in preparing
the project report and also to the lecturer. S.BASAVARAJ, instructor for helping in
making out this project.

We are very thankful to DR.R.N.KULKARNI Head of the Department of Computer


Science and Engineering for his valuable guidance and suggestion.

We would like to express my sincere gratitude to DR.V.C.PATIL Principal for


providing facilities in the college campus.

[Type text] Page 13


[Type the document title]

We are also thankful for all the Staff members of Computer Science and Engineering
dept. for their Co-operation of project report.

[Type text] Page 14


[Type the document title]

ABSTRACT

A mini project developing a dinosaur and appreciate how the basic technique works

enable stencilling with the popup menu and the dinosaur goes away
also notice that opengl lighting works correctly with reflection

[Type text] Page 15


[Type the document title]

CONTENTS
Introduction
Analysis
Design
Snapshots
Conclusion & Future Enhancements
Bibliography

[Type text] Page 16


[Type the document title]

[Type text] Page 17


[Type the document title]

Chapter 1

INTRODUCTION

1.1 INTRODUCTION TO PROJECT

One of the goals of this Software Lab project is to develop a visualization tool.
Forthis purpose a well-known software is used, OpenGL. In this report instead of
directly showing the implementation results, first some OpenGL basics are
introduced so that the reader can understand the things going on behind de
visualization tool.

1.2 COMPUTER GRAPHICS

The Computer Graphics is one of the most effective and commonly used
methods to communicate the processed information to the user. It displays the
information in the form of graphics objects such as pictures, charts, graphs and
diagram instead of simple text.

In computer graphics, pictures or graphics objects are presented as a


collection of discrete picture elements called pixels. The pixel is the smallest
addressable screen element

Computer graphics today is largely interactive: The user controls the contents
structure, and appearance of objects and their displayed images by using input
devices, such as a keyboard, mouse, or touch-sensitive panel on the screen

Computer graphics concerns with the pictorial synthesis of real or imaginary


objects from their computer based models, where as the related field of image
processing treats the converse process, the analysis of scenes, or the reconstruction
of models of 2D or 3D objects from their pictures.

The image processing can be classified as

[Type text] Page 18


[Type the document title]

Image enhancement.
Pattern detection and recognition
Scene analysis and computer vision.
The image enhancement deals with the improvement in the image quality by
eliminating noise or by increasing image contrast. Pattern detection and recognition
deals with the detection and clarification of standard patterns

And finding deviations from these patterns .The optical character recognition (OCR)
technology is a practical example for pattern detection & recognition. Scene
analysis deals with the recognition and reconstruction of 3D model of scene from
several 2D images.

1.3 ADVANTAGES OF INTERACTIVE GRAPHICS

Graphical feed backs to make the simulated environment even more realistic It
provide a tool for producing pictures not only of concrete, real-world objects but
also of abstract ,synthesis of objects.

It as an ability to show moving pictures, and thus it is possible to produce


animations.
With the use of interactive graphics we can control the movement of an
object. The interactive graphics provides tool called motion dynamics. With
this tool user can move and tumble objects with respect to stationary
observer, or he can make object stationary and the viewer moving around
them.
Interactive graphics provides facility called update dynamics.
With the recent development of digital signal processing (DSP) and audio
synthesis chip the interactive graphics can now provide audio feed back
along with the graphical feed backs to make the simulated environment even
more realistic.

1.4 AREAS OF APPLICATION OF COMPUTER GRAPHICS

User interfaces
Plotting of graphs and charts

[Type text] Page 19


[Type the document title]

Office automation and Desktop publishing


Computer aided Drafting and designs
Process control
Cartography

Chapter 2
ANALYSIS
The Reflect-Dino program has modes for disabling the stenciling and polygon offset
uses. It is worth running Dinosaur with these features toggled off so you can see
the sort of artifacts that result. Important point in the Dinosaur is that the floor
texturing, reflections, and shadowing all co-exist properly.

OpenGL provides rendering capabilities that enable real-time halo effects around 3D
objects within the scene. The approach is straightforward, and we can combine the
OpenGL rendering techniques such as Real-time shadows and reflections.

OpenGL API
OpenGL is a cross-language cross-platform API for making three Dimensional graphic
applications. It is todays prevailing API for developing 2-D and 3-D graphic applications. It has
more than 250 built-in functions that can be used to draw complex shapes of different kinds. The
main OpenGL API consists of three different libraries, they are
Gl library,
Glu library, and
Glut library.
The Glut library is the most recently added library to the OpenGL API, and gives the
programmers the capability to exclude the use of many Windows API functions. In the early day
of OpenGL emergence many successful computer graphics developers had to use many Windows

[Type text] Page 20


[Type the document title]

functions in order for their applications to be successful. There are many other APIs that can be
currently being used to develop graphic applications, but OpenGL has made the top of the line
ever since its emergence in the early 1990s. OpenGL is a product of Silicon Graphics and its
popularity has grown largely in video game industry in the last decade to the present day. Since,
C++ alone was not going to be able to complete the rings as efficient as we desired, we decided
to incorporate the OpenGL API into our application. Since OpenGL is well known for creating
many different kinds of computer visualizations, adding it to the rings System was a wise choice
from our part. There are many different sub APIs in the OpenGL graphics library. In this
application we are going to use the opengl32, glu, glut and gluax libraries. Most of the built-in
function used are straight out of the glu or glut library. Glu and glut library has a lot of optimized
functions that has already been build for programmers to utilize.
2.1 SYSTEM ANALYSIS
System analysis and design is a very important process in any software
development process. This process involves the collection of requirements from
existing systems or users of the system. This Process is called as Requirement
Analysis. Once all the requirements are collected we can then proceed with the
actual designing of the system. During Design process we are involved in actual
implementation of the system. This may involve design of algorithms, modules and
other subsystems. We shall discuss in detail the Requirement analysis and design
phase of this project.

2.1.1 Existing system


The existing system shows the implementation of lighting and shading perspective view
in openGL. The system includes the light sources and their components. It also includes surface
material properties applied to TEXTURE, SHADOWS and REFLECTIONS in project. This
system also illustrates perspective view in OpenGL. This system uses relevant GLUT library
functions to create solids.
2.1.2 Proposed system
The proposed system includes the drawing of Reflections, texturing, shadows,
lighting, or other real-time OpenGL rendering effects. It is for also to show how to
combine texturing, reflections, and projected shadows all in real-time with

[Type text] Page 21


[Type the document title]

OpenGL. Choosing different colors and implementing perspective projection or other


proposed features.

2.1.3 Identification of needs


Since this project illustrates the shading and reflecting application. The available graphics
libraries should provide the following features:
Lighting
Shadows
Reflections
Textures
Perspective Projection
Basic Primitive
3D transformations

2.1.4 Hardware Selection

Processor : 1.5Ghz processor or faster, Intel Pentium 4,AMD K-8 (Athlon)


or Later
RAM : 256MB internal RAM
Hard Disk : 2.5 GB free disk space

Monitor : 1024 x 768 display resolution with true color


Keyboard : Standard 101 key Keyboard
Backup Media : Floppy / Hard disk
Mouse(ps/2),Printer (optional)

2.1.4 Software Selection

Operating System : windows 98/higher, windows XP,windows7


Language Tool : C ,C++
Compiler : Turbo C Compiler/Borland C/C++ compiler.
Libraries : Visual basic c++, GL, GLU, GLUT.
Documentation Tool : Ms-Word, Paint

2.2 SOFTWARE REQUIREMENTS SPECIFICATION

[Type text] Page 22


[Type the document title]

This section attempts to bring out the requirements and specifications as given out by the
VishweshwaraiahTechnologicalUniversity for the completion of the package.
Minimum requirements expected are cursor movement. Transformations on
objects/selected area should be possible. Clipping and filling of areas should be possible.
Good user interface, which can be GUI or Iconic or Menu based, should be provided. On-
line help for all the options and methods of usage should be given. Should use almost all
the graphical input technologies for efficient programming of input devices. Should be a
device independent package that is able to compile and create an executable.
2.3 FUNCTIONAL REQUIREMENTS
It should give a clear picture of simple animation.
It should show the usage of perspective view and material properties.
It shall be able to meet the users animation requirements.
It shall be able to run even over the low end systems.
It shall be easy to understand.
2.4 EXTERNAL INTERFACE REQUIREMENTS
2.4.1 User Interface
The interface for the project requires for the user to have a mouse connected, and the
corresponding drivers installed. This is because most of the implementation details
require and presume the presence of a mouse.
For the convenience of the user, there are pop-up menus and sub-menus displayed on the
screen.
POP-UP MENU:
A menu that can be set to appear when a specified mouse button is pressed in a window.
A pop-up menu consists of multiple menu items.
SUB-MENU:
A menu cascaded from some sub-men you trigger.

2.4.2 Hardware Interface


The standard output device, as mentioned earlier has been assumed to be a color monitor. It is
quite essential for any graphics package to have this, as provision of color options to the user is
must. The mouse, the main input device, has to be functional.
Apart from these hardware requirements, there should be sufficient hard disk space and
primary memory available for proper working of the package.

[Type text] Page 23


[Type the document title]

2.4.3 Software Interface


The OpenGL API is windows-system and operating-system independent. The OpenGL
API has been integrated with Microsoft Windows and with the X Windows System under
UNIX. Also, the OpenGL API is network-transparent. An independent consortium, the
OpenGL Architecture Review Board, guides the OpenGL specification. With broad industry
support, the OpenGL API is the only truly open, stable, vendor-neutral, multiplatform graphics
standard.

Chapter 3

DESIGN
3.1 DATA DESIGN
The Data Design describes structures that reside within the software. Attributes and
relationships between data objects dictate the choice of data structures. Designing data is about
discovering and completely defining your application's data characteristics and processes. Data
design is a process of gradual refinement, from the coarse "What data does your application
require?" to the precise data structures and processes that provide it. With a good data design,
your application's data access is fast, easily maintained, and can gracefully accept future data
enhancements.
Data Structures Used
The data structures that we are making use in this package are arrays, pointers, stack.
Arrays: The arrays are used to hold continuous homogeneous data in linear order.
Pointer:Pointers are the memory locations that are stored in the memory cells. By using a
pointer, by holding a memory address rather than the data one memory cell can point to another
memory cell.
Stack:Last-In, First-Out" or LIFO, which is used to describe the behavior, since the last item to
enter the stack is the first item to leave the stack. The top item is the item always the last item to

[Type text] Page 24


[Type the document title]

enter the stack and it is always the first item to leave the stack since no other items can be
removed until the top item is removed. Stack is used to push and pop matrices while performing
transformations such as rotation, translation and scaling.
3.1.1 Data Definition
Explains the general process of defining tables, rows, columns, data types, keys, and
relationships. The various data types used in our project are
GLfloat: A GLfloat data type is used to declare float variables. .
Enum: An enumeration type declaration contains the enum keyword followed by an optional
identifier (the enumeration tag) and a brace-enclosed list of enumerators. Commas separate each
enumerator in the enumerator list. The keyword enum, followed by the identifier, names the data
type. The list of enumerators provides the data type with a set of values.
3.2 ARCHITECTURAL DESIGN

3.2.1 Modules and their Descriptions

Standard Graphics Functions Used:

glutInitglutInit is used to initialize the GLUT library.

Syntax: void glutInit (int *argcp, char **argv);

argcp: A pointer to the program's unmodifiedargc variable from main. Upon return,
the value pointed to by argcp will be updated, because glutInit extracts any
command line options intended for the GLUT library.

argv: The program's unmodifiedargv variable from main. Like argcp, the data for
argv will be updated because glutInit extracts any command line options
understood by the GLUT library

GlutInitWindowPosition and glutInitWindowSize: set the


initial window position and size respectively.
Syntax: void glutInitWindowSize (int width, int height);

Void glutInitWindowPosition (int x, int y);

[Type text] Page 25


[Type the document title]

Width Width in pixels.

height Height in pixels.

glutInitDisplayMode

Syntax: glutInitDisplayMode sets the initial display mode.


Void glutInitDisplayMode (unsigned int mode);
mode Display mode, normally the bitwise OR-ing of GLUT display mode bit masks.
See values below

GLUT_RGB An alias for GLUT_RGBA.

GLUT_DEPTH Bit mask to select a window with a depth buffer

GLUT_DOUBLE Bit masks to select a double buffered window. This overrides


GLUT_SINGLE if it is also specified

glutCreateWindow

glutCreateWindow creates a top-level window.


Syntax:intglutCreateWindow(char *name);
name ASCII character string for use as window name.

glutMainLoop

glutMainLoop enters the GLUT event processing loop.


Syntax: void glutMainLoop (void);
glutMainLoop enters the GLUT event processing loop. This routine should be called at most
once in a GLUT program. Once called, this routine will never return. It will call as necessary any
callbacks that have been registered.

glutSwapBuffers

glutSwapBuffers swaps the buffers of the current window if double buffered.


Syntax: void glutSwapBuffers(void);

gluLookAt Function

The gluLookAt function defines a viewing transformation.

[Type text] Page 26


[Type the document title]

Syntax: void gluLookAt (eyex, eyey, eyez,centerx, centery, centerz,upx, upy, upz);
Eyex, eyey, eyezThe position of the eye point.

centerx, centery, centerz The position of the reference point

upx, upy, upz The direction of the up vector

glCallList

glCallList- execute a display list


Syntax: void glCallList (GLuintlist)
list Specifies the integer name of the display list to be executed.

glEnable

GlEnable, glDisable- enable or disable GL capabilities


Syntax: void glEnable (GLenumcap )
Void glDisable (GLenumcap )
Cap Specifies a symbolic constant indicating a GL capability.
GL_DEPTH_T If enabled, do depth comparisons and update the depth buffer
EST

GL_LIGHTIN
G If enabled, use the current lighting parameters to compute the
vertex color or index

GL_NORMAL
IZE If enabled, normal vectors specified with glNormal are scaled to unit
length after transformation

glFrustum

GlFrustum- multiply the current matrix by a perspective matrix


Syntax: void glFrustum (GLdoubleleft, GLdoubleright, GLdoublebottom, GLdoubletop,
GLdoublenear, GLdoublefar )
left, right Specify the coordinates for the left and right vertical clipping planes.

bottom,t Specify the coordinates for the bottom and top horizontal clipping planes.
op

near, far Specify the distances to the near and far depth clipping planes. Both distances must
be positive.

[Type text] Page 27


[Type the document title]

glLight:glLightfv, glLightiv- set light source parameters


Syntax: void glLightfv (GLenumlight, GLenumpname, constGLfloat*params )
Void glLightiv (GLenumlight, GLenumpname, constGLint*params )
Light Specifies a light. The number of lights depends on the implementation, but at least eight
lights are supported. They are identified by symbolic names of the form GL_LIGHTi
where 0 i<GL_MAX_LIGHTS.
Pname Specifies a light source parameter for light. GL_AMBIENT, GL_DIFFUSE,
GL_SPECULAR, GL_POSITION, GL_SPOT_DIRECTION, GL_SPOT_EXPONENT,
GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION,
GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are accepted.
Params Specifies a pointer to the value or values that parameter pname of light source light will be
set to.

glLightModel
glLightModelfv, glLightModeliv- set the lighting model parameters
Syntax:voidglLightModelfv( GLenumpname, constGLfloat*params )
voidglLightModeliv( GLenumpname, constGLint*params )

Pnam Specifies a lighting model parameter. GL_LIGHT_MODEL_AMBIENT,


e GL_LIGHT_MODEL_LOCAL_VIEWER, and GL_LIGHT_MODEL_TWO_SIDE
are accepted.
Param Specifies a pointer to the value or values that params will be set to.
s

glMaterial

glMaterialfv, glMaterialiv- specify material parameters for the lighting model


Syntax: void glMaterialfv (GLenumface, GLenumpname, constGLfloat*params )
Void glMaterialiv (GLenumface, GLenumpname, constGLint*params )
Face Specifies which face or faces are being updated. Must be one of GL_FRONT,
GL_BACK, or GL_FRONT_AND_BACK.
Pnam Specifies the material parameter of the face or faces that is being updated. Must be one
e of GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,

[Type text] Page 28


[Type the document title]

GL_SHININESS, GL_AMBIENT_AND_DIFFUSE, or GL_COLOR_INDEXES.


Param Specifies a pointer to the value or values that pname will be set to.
s function displays the different primitives, texturing, reflections, and pr

[[

glNewList

glNewList, glEndList- create or replace a display list


Syntax:voidglNewList( GLuintlist, GLenummode )
List Specifies the display list name.
Mode Specifies the compilation mode, which can be GL_COMPILE or
GL_COMPILE_AND_EXECUTE.

GL_COMPILE Commands are merely compiled.


GL_COMPILE_AND_EXE Commands are executed as they are compiled into the display list.
CUTE

glPushMatrix

GlPushMatrix, glPopMatrix- push and pop the current matrix stack.


Syntax:voidglPushMatrix( void )
voidglPopMatrix( void )

glScale
glScaled, glScalef- multiply the current matrix by a general scaling matrix
Syntax:voidglScaled( GLdoublex, GLdoubley, GLdoublez )
void glScalef( GLfloatx, GLfloaty, GLfloatz )
x,y,z Specify scale factors along the x, y, and z axes, respectively

glViewport Function

The glViewport function sets the viewport.


Syntax :voidglViewport(x, y,width, height);
x, y The lower-left corner of the viewport rectangle, in pixels. The default is (0,0).

[Type text] Page 29


[Type the document title]

width, height The width and height, respectively, of the viewport. When an OpenGL
context is first attached to a window, width and height are set to the dimensions of
that window.

User Defined Functions Used:

void shadowMatrix(GLfloatshadowMat[4][4],
GLfloatgroundplane[4],GLfloatlightpos[4])

This function creates a matrix that will desire shadows and this function also
having dot product between light position vector and groundplane.

static void makeDinosaur(void)

This function shows the properties of dinosaur. For example body, arms,
colors etc.

static void drawDinosaur(void)

This function draws the structure of dinosaur with properties.

static void drawPillar(void)

This function draws the pillar with properties.

static void controlLights(int value)

This function controls the light for dinosaur ii in textures, shadow, and
reflection.

static void visible(intvis)

This function indicates that when not visible, stop animating. Restart when
visible again.

static void display(void)

This function displays the different primitives, texturing, reflections, and


projected shadows all in real-time with OpenGL.

[Type text] Page 30


[Type the document title]

Graphics Pipeline Architecture:

The model coordinate pipeline is optimized for vertex arrays and display list
mode. The model coordinate pipeline also recognizes consistent data types within
glBegin/glEnd pairs. One of the major advances in graphics software systems
occurred when graphics systems allowed uses to work in any coordinate system
that they design. The users coordinate system is called world coordinate system.
The Orthogonal coordinate system usually referred to as viewing coordinate
system. We must do clipping because of the limitation that no imaging system can
see the whole world advance. We obtain the equivalent property in the synthetic
camera by considering a clipping volume. The projections of objects in this
volume appear in the image. Those that are outside do not and are said to be
clipped out. For raster devices, such as most CRT displays, unit on the display are
called window coordinates and are always expressed in some integer type. A
viewport is a rectangular area of display window. The viewport is a part of the
state. If we change the viewport between rendering objects orrerendering the same
objects with the viewport changed, we achieve the effect of multiple viewports with
different images in different parts of the window

Block diagram of Graphic Pipeline Architecture 3.1

3.3 INTERFACE DESIGN

[Type text] Page 31


[Type the document title]

The Interface Design describes internal and external program interfaces as well as
the design of human interface. Internal and external interface design is based on
the information obtained from the analysis model.The Conceptual framework model
for an interactive graphics system is shown in figure below. It mainly consists of
Application Model, Application Program, and Graphics system and hardware
components. Each of these systems interacts to produce an effective graphics
display. The detailed description of the components is explained in the following
section.

Graphics System

Applicationmodel
Application program

Software Components
Hardware Components

Conceptual Framework of Interactive Graphics fig 3.5

Application Model: The application model captures all the data and objects to be
pictured on the Screen. It also captures the relationship among the data and objects
these relationship are stored in the database called application database, and
referred by the application programs.

Application Program: It creates the application model and communicates with it


to receive and store the data and information of objects attributes. The application
program also handles user input. It produces views by sending a series of graphics
output commands to the graphics system. Application program is written in TC with
graphics package included in that. The application program is also responsible for
interaction handling.

Graphics System: It accepts the series of graphics output commands from


application program. The output commands contain both a detailed geometric
description of what is to be viewed and the attributes describing how the objects

[Type text] Page 32


[Type the document title]

should appear. The graphics system is responsible for actually producing the picture
from the detailed descriptions and for passing the users input to the application
program for processing.

Hardware Components: The hardware components used here are CRT interfaced
screen, mouse and keyboard.

3.4 PROCEDURAL DESIGN

The ProceduralDesign describes structured programming concepts using graphical,


tabular, and textual notations. These design mediums enable the designer to
represent procedural detail that facilitates translation to code. This blueprint for
implementation forms the basis for all subsequent software engineering work.

3.4.1 User Interface Design:

Graphical User Interface:

Some basic GUI was added to the application for friendly interaction purposes. By
reading to this point you might have noticed that most of the functionalities of this application
are done through the keyboard. The keyboard functions will be described in more details in the
appendix.
This applications main source of communication with the user is the keyboard, which
can be a little bit of a problem for users who do not want to memorize what every single key on
the keyboard does. For that purpose we decided to introduce a pop up menu that will display on
the screen by the users request. This pop-up menu contains almost every single command that
the user can request from the application using the keyboard buttons. All the user has to do is
right click the mouse and it displays all the options.
3.5 DATA FLOW DIAGRAM

[Type text] Page 33


[Type the document title]

Chapter 4

SAMPLE OUTPUTS

[Type text] Page 34


[Type the document title]

[Type text] Page 35


[Type the document title]

Chapter 5

CONCLUSION & FUTURE ENHANCEMENTS

Conclusion:

Creating the interactive program like Halomagic of dinosaur was a very interesting
experience. Using the two different APIs was a very useful part of the program
success. The Halomagic is an interactive 3D program.openGl has given us the
capability to easily create the textures, shadows and reflections of DINOSAUR and
PILLAR and position them in their respective positions. The Halomagic application
has demonstrated how a users input can be processed at a very fast speed and
redisplayed on the screen.

[Type text] Page 36


[Type the document title]

Also my thanks to our lab in charges who set strict guidelines without which our
project wouldnt have been what it is now.

Future Enhancements:

The Halomagic program is done as a part of laboratory curriculum due to critical


time constraints some other features could not be implemented. Features that can
be added to enhance user friendliness are:

Keyboard interface
Choosing color
Better background

[Type text] Page 37


[Type the document title]

BIBLIOGRAPHY

9.1 Books Referred:


[1] Interactive Computer Graphics, A top down approach using openGL, Edward
Angel, 5th edition.
[2] Software Engineering by Ian Sommer Ville.
[3] Data Structures Using C and C++ by Padma Reddy.
9.2Websites Referred:
[1] http://www.opengl.org
[2] http://www.wikipidia.org
[3] http://www.vterrain.org/
[4] http://www.codecolony.de/OpenGL/
[5] http://www.opengl.org/

[Type text] Page 38


[Type the document title]

[Type text] Page 39

You might also like