project report

27
CONTENTS CHAPTER NO. TITLE PAGE NO. CHAPTER 1 INTRODUCTION 3-6 1.1 Introduction Computer Graphics 3 1.2 Open GL 4 1.3 Problem Section Statement 5 1.4 Existing System 5 1.5 Proposed System 6 1.6 Objectives Of The Project 6 CHAPTER 2 SPECIFICATION REQUIREMENTS 7 2.1 U SER REQUIREMENTS 2.2 S OFTWARE REQUIREMENTS 2.3 H ARDWARE REQUIREMENTS 2.4 D EVELOPMENT PLATFORM

Upload: murali-manohar-krishna-g

Post on 24-Oct-2014

169 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Project Report

CONTENTS

CHAPTER NO. TITLE PAGE NO.

CHAPTER 1 INTRODUCTION 3-6 1.1 Introduction Computer Graphics 3

1.2 Open GL 4

1.3 Problem Section Statement 5

1.4 Existing System 5

1.5 Proposed System 6

1.6 Objectives Of The Project 6

CHAPTER 2 SPECIFICATION REQUIREMENTS 7 2.1 USER REQUIREMENTS

2.2 SOFTWARE REQUIREMENTS

2.3 HARDWARE REQUIREMENTS

2.4 DEVELOPMENT PLATFORM

CHAPTER 3 DESIGN 8

CHAPTER 4 IMPLEMENTATION 9

CHAPTER 5 TESTING

13

CHAPTER 6 SNAPSHORTS

15

CHAPTER 7 CONCLUSION

Page 2: Project Report

Water Ripple Effect

LIST OF FIGURES

Figure 1.1 : : Library Organization of OpenGL

Figure 1.2 : : Graphics system as black box

Figure 3.1 : : Flowchart

Figure 6.1 : : Water image in Red color

Figure 6.2 : : Water image in Blue color

Figure 6.3 : : Ripple formations in water

Figure 6.4 : : Water pool with ripple at some angle

Figure 6.5 : : Perspective viewing of waterpool from a distance

Dept of CSE,SCE Page 2

Page 3: Project Report

Water Ripple Effect

CHAPTER 1

INTRODUCTION

1.1 INTODUCTION TO COMPUTER GRAPHICS:

Computer Graphics is concerned with all aspect of producing pictures or image using

computer. The field began humble almost 50 years ago, with the display of few lines on the

cathode-ray tube(CRT); now, we can create image using computer that are indistinguishable from

photographs from the real objects. We routinely train pilots with simulated airplane, generating

graphical display of the virtual environment in the real time. Feature length movies made entirely

by computer have been successful, both critically and financially; massive multiplayer game can

involve tens of thousands of concurrent participants.

Graphics is created using computers and, more generally, the representation and

manipulation of pictorial data by a computer. The development of computer graphics has made

computers easier to interact with and better for understanding and interpreting many types of data.

Developments in computer graphics have had a profound impact on many types of media and have

revolutionized the animation and video game industry. The phrase “Computer Graphics” was

coined in 1960 by William Fetter, a graphic designer for Boeing.

In today’s world advanced technology, interactive computer graphics has become a

powerful tool for the production of realistic features. Today’s we find computer graphics used in

various areas that include science, engineering, medicine, business, industry, art, entertainment etc.

The main reason for effectiveness of the interactive computer graphics is the speed with which the

user can understand the displayed information.The graphics in openGL provides a wide variety of

built-in function. The computer graphics remains one of the most exciting and rapidly growing

computer fields. It has become a common element in user interface, data visualization, TV

commercials, motion picture and many other applications.

Dept of CSE,SCE Page 3

Page 4: Project Report

Water Ripple Effect

1.2 INTRODUCTION TO OPEN GL (Open Graphics Library):

OpenGL has become a widely accepted standard for developing graphics application. OpenGL is

easy to learn, and it possesses most of the characteristics of other popular graphics system. It is

top-down approach. OpenGL 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 three-dimensional 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 Direct3D on Microsoft Windows platforms.

The interface between the application program and the graphics system can be specified through

that set of function that resides in graphics library. The specification is called the APPLICATION

PROGRAM INTERFACE (API). The application program sees only the API and is thus shielded

from the details both the hardware and software implementation of graphics library. The software

driver is responsible for interpreting the output of an API and converting these data to a form that

is understood by the particular hardware.

Most of our applications will be designed to access openGL directly through functions in three

libraries. Function in the main GL library have name that begin with the letter gl and stored in the

library. The second is the openGL utility Library (GLU). This library uses only GL function but

contains codes for creating common object and viewing. Rather then using a different library for

each system we used available library called openGL utility toolkit (GLUT). It used as

#include<glut.h>

A graphics editor is a computer program that allows users to compose and edit pictures

interactively on the computer screen and save them in one of many popular “bitmap” or “raster”

format.The applications of computer graphics in some of the major areas are as follows

Display of information.

Design.

Dept of CSE,SCE Page 4

Page 5: Project Report

Water Ripple Effect

Simulation and Animation.

User interfaces.

FIG1.1:Library operations of opengl

OpenGL is a software interface to graphics hardware. This interface consists of about 150 distinct

commands that you use to specify the objects and operations needed to produce interaction.

1.3 EXISTING SYSTEM

OpenGL can be used to draw 3D objects like sphere, cube and lines using homogeneous coordinate

system. We use these representations to create our project, also using various Interactive computer

graphics is the most important means of producing pictures since the invention of photography and

television existing functions for the various other features that are added to the project

1.4 PROBLEM SECTION STATEMENT

Computer graphics is no longer a rarity. It is an integral part of all computer user interfaces, and is indispensable for visualizing 2D; 3D and higher dimensional objects .Creating 3D objects,

Dept of CSE,SCE Page 5

GLU

GL

GLUT

GLX

FrameBuffer

Xlib,Xtk

OpenGlApplication

Page 6: Project Report

Water Ripple Effect

rotations and any other manipulations are laborious process. Implementation using OpenGL provides more features for developing 3D objects with few built in functions.

The geometric objects are the building blocks of any individual .Thereby developing, manipulating, applying any transformation, rotation, scaling on them is the major task of any image development.

Thereby we have put our tiny effort to develop watery image, and perform different operations on

them by using OpenGL utilities.

Fig 1.2:Graphic system as black box

1.5 OBJECTIVES OF THE PROJECT

Developing a package using computer graphics with OpenGL.

Implementing certain technical concept like Translation, motion,scaling and use of Idle Function.

How to use Lightning effects used to produce computer animation

Providing facility to view the object in different view like front view, sideview etc,.

Dept of CSE,SCE Page 6

ApplicationProgram

Graphicssystem

Ip/op devices

Page 7: Project Report

Water Ripple Effect

CHAPTER 2

SPECIFICATION REQUIREMENTS

2.1 User Requirements:

Easy to understand and should be simple.

The built-in functions should be utilized to maximum extent.

OpenGL library facilities should be used.

2.2 Software Requirements:

Any Windows OS.

Microsoft Visual Studio 2005 (or) Microsoft Visual C++

CODING LANGUAGE :C, C++

2.3 Hardware Requirements:

Processor- Intel or AMD(Advanced Micro Devices)

RAM- 512MB(minimum)

Hard Disk-300MB(minimum)

Mouse

Keyboard

Monitor

Dept of CSE,SCE Page 7

Page 8: Project Report

Water Ripple Effect

CHAPTER 3

DESIGN 3.1 FLOWCHART

Dept of CSE,SCE Page 8

Page 9: Project Report

Water Ripple Effect

Dept of CSE,SCE Page 9

START

MAIN

INITIALIZECALLBACK FUNC

MOUSE BOTTON

Rightclick

Blue Color Red Color Other Function QuitGreen Color

Zoom In Zoom Out

Angle Of View

Full Screen

Small Screen

Keyboard func

STOP

Page 10: Project Report

Water Ripple Effect

CHAPTER 4

IMPLEMENTATION

In this project we have used some of the built in functions and library functions defined in glut header files.

Description of <GL/glut.h> header file

The header file <GL/glut.h> includes the standard commands that help us in

executing the OpenGL codes. It supports inbuilt functions. Below listed are some of the standard

commands that are included in this project.

BUILT IN FUNCTIONS

1. voidglutInit ( intargc, char **argv)

The interaction between the windowing system and OpenGL is initiated. The two arguments allow the user to pass command-line arguments, as in the standard C main function.

Dept of CSE,SCE Page 10

Page 11: Project Report

Water Ripple Effect

2. voidglutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH)

It specifies RGB color, a depth buffer for hidden-surface removal, and double buffering.

3. voidglutInitWindowSize(intwidth,int height)

It specifies the initial height and width of the window in pixels.

4. voidglutReshapeFunc(void *f(intwidth,int height))

It registers the callback function f. The callback function returns the height and width of the window. The reshape callback invokes a display callback.

5. voidglutDisplayFunc(void (*func)(void))

It registers the display function func that is executed when the window needs to be redrawn.

6. voidglViewport(intx,inty,GLsizei width, GLsizei height)

It specifies a width×height viewport in pixels whose lower-left corner is at (x,y) measured from the origin of the window.

7. voidglutSwapBuffers( )

Swaps the front and back buffers. The front buffer is always the one displayed, whereas the back buffer is the one into which we draw.

8. voidglPushMatrix() void glPopMatrix( )

It pushes to and pops from the matrix stack corresponding to the current matrix mode.

9. voidglRotate[fd](TYPE angle,TYPE dx, TYPE dy, TYPE dz)

It alters the current matrix by a rotation of angle degrees about the axis(dx,dy,dz). TYPE is either GLfloat or GLdouble.

Dept of CSE,SCE Page 11

Page 12: Project Report

Water Ripple Effect

10. voidglTranslate[fd] (TYPE x, TYPE y, TYPE z)

It alters the current matrix by a displacement of (x,y,z). TYPE is either GLfloat or GLdouble.

11. voidglEnable(GLenum feature)

It enables an OpenGL feature.

12. voidglMatrixMode(GLenum mode)

specifies which matrix will be affected by subsequent transformations mode can be GL_MODELVIEW,GL_PROJECTION,or GL_TEXTURE.

13. voidglLoadIdentity()

sets the current transformation matrix to an identity matrix.

14. voidglortho(GLdoubleleft,GLdoubleright,GLdoublebottom,GLdoubletop,GLdoublenear,GLdouble far)

Defines an orthographic viewing volume with all parameters measured from the center of the projection Plane.

15. void glOrtho2D(GLdoubleleft,GLdoubleright,GLdoublebottom,GLdouble top)

defines a two-dimensional viewing rectangle in the plane z=0.

16. voidglBegin(glEnum mode)

Initiates ia new primitive of type mode and starts collection of vertices.Values of mode include GL_POINTS,GL_LINES,GL_POLYGON.

17. voidglEnd()

Dept of CSE,SCE Page 12

Page 13: Project Report

Water Ripple Effect

Terminates a list of vertices.

18. voidglutMouseFunc(void *f(intbutton,intstate,intx,int y)

registers the mouse callback function f.thecallback function returns the button (GLUT_LEFT_BUTTON,GLUT_MIDDLE_BUTTON,GLUT_RIGHT_BUTTON),the state of the button

after the event(GLUT_UP,GLUT_DOWN),and the position of the mouse relative to the top-left

corner of the window.

19. void key(unsigned char key,int x ,int y)

This function is used assign various key to function.

20. void display( )

This function is used to display different objects.

Dept of CSE,SCE Page 13

Page 14: Project Report

Water Ripple Effect

CHAPTER 5

TESTING

The general testing process that started with the testing of individual program units such

as functions or objects. The model of testing process is appropriate for large systems, or for

systems that are developed through reuse.

The fundamental testing activities are

Component testing: Testing the parts of system.

System testing: Testing the system as whole.

GOALS OF TESTING:

The general aim of testing is to affirm the quality of software systems by systematically

exercising the software in carefully controlled circumstances.

Dept of CSE,SCE Page 14

Serial no Test case description

Expected result Actual result Remarks

1. Right click the

mouse button

on display

screen

Menu with

Green

Red

Blue

Shape Change

Quit

Should be

displayed

Menu with

Green

Red

Blue

Shape Change

Quit

Is displayed

Pass Serial no Test case

descriptionExpected result Actual result Remark

2. Click on

Green

The Color of the

image of water on the

display screen is

changed to Green.

Should happen.

The Color of the

image of water on the

display screen is

changed to Green.

Happens.

Pass

Page 15: Project Report

Water Ripple Effect

CHAPTER 6

SNAPSHOTS

SNAPSHOT 1:

Fig 6.1: Water image in Red color.

Dept of CSE,SCE Page 15

3 Click on

Red

The Color of the

image of water on the

display screen is

changed to Red.

Should happen.

The Color of the

image of water on the

display screen is

changed to Red.

Happens.

Pass 4 Click on

Blue

The Color of the

image of water on the

display screen is

changed to Blue.

Should happen.

The Color of the

image of water on the

display screen is

changed to Blue.

Happens.

Pass

5 Click on

Change Shape

A submenu with

options to change the

shape of water image.

Must be displayed

A submenu with

options to change the

shape of water image

Is displayed

Pass

Page 16: Project Report

Water Ripple Effect

SNAPSHOT 2:

Fig 6.2: Water image in Blue Color.

Dept of CSE,SCE Page 16

Page 17: Project Report

Water Ripple Effect

SNAPSHOT 3:

Fig 6.3: Ripple Formations in water.

Dept of CSE,SCE Page 17

Page 18: Project Report

Water Ripple Effect

SNAPSHOT:4

Fig 6.4: WATERPOOL WITH RIPPLE AT SOME ANGLE

Dept of CSE,SCE Page 18

Page 19: Project Report

Water Ripple Effect

SNAPSHOT:5

Fig 6.5: PERSPECTIVE VIEWING OF WATER POOL FROM A DISTANCE

Dept of CSE,SCE Page 19

Page 20: Project Report

Water Ripple Effect

CHAPTER 7

CONCLUSION

An attempt has been made to develop an OpenGL package which meets necessary

requirements of the user successfully. Since it is user friendly, it enables the user to interact

efficiently and easily.

The development of the mini project has given us a good exposure to OpenGL by which we

have learnt some of the technique which help in development of animated pictures, gaming.

Hence it is helpful for us even to take up this field as our career too and develop some other

features in OpenGL and provide as a token of contribution to the graphics world.

The mini project developed has a scope for future enhancement too as follows

Making the water seem more realistic. Adding lighting effects etc,.

By implementing a project using Open GL we came to know how to use The functions like

menu‘s, rotation, translation and scaling.

FUTURE ENHANCEMENT

This project has been designed using C++, which works on the Windows platform. The

project can be designed using other languages and better graphical interfaces .The following

features have been incorporated

Resizing windows

Choosing color

BIBLIOGRAPHY

The books and the other sources we referred while doing this project are as

follows:

Dept of CSE,SCE Page 20

Page 21: Project Report

Water Ripple Effect

REFERENCES:

Interactive Computer Graphics – A Top-Down Approach Using OpenGL.

Computer Graphics Using OpenGL – F.S Hill, Jr.,2nd Edition, Pearson

Education ,2001

Computer Graphics – James D Foley , Andries Van Dam , Steven K Feiner ,

John F Hughes , Addison – Wesley

ONLINE REFERENCES:

www.codecolony.de/opengl

www.openGL.org

www.SourceCodeWorld.com

www.openglprojects.in

Dept of CSE,SCE Page 21