+ All Categories
Home > Documents > Mini Project Report

Mini Project Report

Date post: 18-Sep-2015
Category:
Upload: james-fields
View: 592 times
Download: 80 times
Share this document with a friend
Description:
Mini project
Popular Tags:
49
Hot Air Balloon CHAPTER – 1 INTRODUCTION 1.1 COMPUTER GRAPHICS Computer graphics are graphics created using computers and the representation of image data by a computer specifically with help from specialized graphic hardware and software. The interaction and understanding of computers and interpretation of data has been made easier because of computer graphics. Computer graphic development has had a significant impact on many types of media and has revolutionized animation, movies and the video game industry. The term computer graphics has been used in a broad sense to describe "almost everything on computers that is not text or sound". Typically, the term computer graphics refers to several different things: The representation and manipulation of image data by a computer The various technologies used to create and manipulate images. The sub-field of computer science which studies methods for digitally synthesizing and manipulating visual content , see study of computer graphics. Many powerful tools have been developed to visualize data. Computer generated imagery can be categorized into several Dept of CSE,GCEM Page 1
Transcript

Hot Air Balloon

Hot Air Balloon

CHAPTER 1 INTRODUCTION1.1 COMPUTER GRAPHICS

Computer graphics are graphics created using computers and the representation of image data by a computer specifically with help from specialized graphic hardware and software. The interaction and understanding of computers and interpretation of data has been made easier because of computer graphics. Computer graphic development has had a significant impact on many types of media and has revolutionized animation, movies and the video game industry.

The term computer graphics has been used in a broad sense to describe "almost everything on computers that is not text or sound".

Typically, the term computer graphics refers to several different things: The representation and manipulation of image data by a computer The various technologies used to create and manipulate images. The sub-field of computer science which studies methods for digitally synthesizing and manipulating visual content , see study of computer graphics.

Many powerful tools have been developed to visualize data. Computer generated imagery can be categorized into several different types: two dimensional (2D), three dimensional (3D), and animated graphics. As technology has improved, 3D computer graphics have become more common. Computer graphics has emerged as a sub-field of computer science which studies methods for digitally synthesizing and manipulating visual content. Over the past decade, other specialized fields have been developed like information visualization, and scientific visualization more concerned with "the visualization of three dimensional phenomena (architectural, meteorological, medical, biological, etc.), where the emphasis is on realistic renderings of volumes, surfaces, illumination sources, and so forth, perhaps with a dynamic (time) component. Computer Graphics may be used in areas like Computer simulation, Digital Art, Infographics, Virtual Reality, Web design.

1.2. Introduction to OpenGL: The field of computer graphics continues rapidly growing with an ever-increasing number of applications in diverse areas, such as entertainment, business, art, education, medicine, engineering, and industry. A Numbers of software packages have emerged to help generate and manipulate two-dimensional (2D)/three-dimensional (3D) graphics. OpenGL is a graphical application programming interface (API) for the C/ C++ programming language. The primary motivation for developing OpenGL API is to create an operating system, window system, and hardware platform independentAPI for the development of 2D/3D graphics. Since OpenGL API was introduced in 1992, many applications, such as CAD, CAM, and game development, have benefited from its cross-platform accessibility. OpenGL has become a premier environment for developing portable 2D/3D graphics applications. It is also widely used for teaching and learning computer graphics. The features of device independence and portability make OpenGL a strategic interface for courses on computer graphics. Computer platforms vary from instructor to student and from school to student home. By using OpenGL, programs developed on a machine can be debugged and graded on other machines with different platforms, and the resulting graphics are the same.

OpenGL is the most widely used application programming interface (API) for developing portable 2D and 3D graphics applications. It was originally developed in 1992 by Silicon Graphics and is currently controlled and maintained by the OpenGL ARB (Architecture Review Board), which has become a part of the Khronos Group in 2006.

According to OpenGL.org, OpenGL is the only truly open, vendor-neutral, multiplatform graphics standard. OpenGL 2.1 is the latest version of OpenGL and was released on August 22006. OpenGL 3.0 is currently under development and will run specifically on hardware born after November 8th, 2006.

GLUT supports the following functionality: Window management Event handling Right click menu Rendering fonts

Rendering various solid and wireframe object 1.3 INTRODUCTION TO Hot Air Balloon

Objective: The objective is to demonstrate hot air balloon which uses the key press input. The first snap displays the cover page which on using the Enter key displays the hot air balloon in the first screen.Hot Air Balloon is aimed at demonstrating the different features used in the field of computer graphics like interactivity, transformation, projection etc.The transformation like translation is demonstrated in the project. The translation used in the program gives a moving effect of the hot air balloon starting from first screen along with the man who is travelling to his desired places in the hot air balloon, by moving towards the top and switches to the second screen, moving at the top from one end of the second screen to the other and finally switches to the third screen where it translates from the top to the bottom and halts as of when he man gets down from the hot air balloon and walks towards his tent as the night falls.

Orthographic scenario is also demonstrated with which projects the entire scenario to the model view plane.

Scope: OpenGL which is a multiplatform application programming interface in the field of graphics is used to interact with a graphic processing unit, achieve accelerated rendering. It has a significant impact on many types of media and has revolution movies, and video game industries. OpenGL in the field of graphics and animation is designed to translate function calls int graphic commands that can be sent to underlying graphic hardware because their underlying hardware is dedicated to processing graphic commands. OpenGL drawing is typically very fast. The GL kit provides a drawing surface and animation.

1.4 About the project: This mini project Hot Air Balloon demonstrates the hot air balloon starting from the first screen translates from bottom to top diagonally on the usage of the keys along with the man popping into the hot air balloon on the click of the keys and the translation of the birds is also observed in the first screen as the balloon translates. Then it moves to the second screen from one end of the screen to the other end horizontally as well as we can find the clouds translating near to the balloons translation, finally the hot air balloon translates to the third screen from top to bottom diagonally and finally halts where the man gets off the hot air balloon and translates to his tent. This is indeed an interactive project which has efficient interaction given through the keyboard option.Hot Air Balloon is aimed at demonstrating the different features used in the field of computer graphics like interactivity, transformation, projection, etc. Interactivity by the user with the system is explained using key press inputs.

CHAPTER 2 SYSTEM REQUIREMENTS2.1 Software Requirement: Operating systems : Ubuntu LINUX version 10.04 or higher

Package : OpenGL, Graphics Library Utility Toolkit

Languages : C, C++

2.2 Hardware Requirement: Visual Display Unit : 1024x768 resolutions or higher

Graphics Driver : onboard graphics

Processor : Intel Pentium Processor or higher

Processor Speed : 500 MHz or above

RAM : 128 MB or higher

Storage Space : Approx 2 MB

2.2.1 INPUT REQUIREMENT: The input devices used here is the keyboard and menu function. The project developed here takes the keyboard keys as inputs. We have used many built-in functions such as colour function, material functions etc. All these functions take some numerical values which will be initialized before they are used. The usage of the menu display function is the change the color of the sun of 3 color version display to be projected.

2.2.2 OUTPUT REQUIREMENTS: The program outputs GUI (Graphical User Interface) based screen. The output will be displayed on the monitor. The output consists of hot air balloon with a man, translating through the three screens on the usage of the keys when pressed will start and halt the hot air balloon.

CHAPTER 3 SYSTEM DESIGN3.1 Data Flow Diagram In this project we design an application called hot air balloon where the objective of the hot air balloon is to translate from the first screen to the third screen. The interactivity can be explained using the following flow diagram, how the control moves to the different functions.

S t a r tThe project can be designed as follows:

main()

mydisplay()

Front screen

keyboard

Screen3Screen1

end()

Stop

CHAPTER 4 SYSTEM IMPLEMENTATIONThe project entitled, Hot Air Balloon can be implemented using functions that can be explained as follows: 4.1 Algorithm code for main function1. Initialize the display mode2. Initialize the window position and size3. Create display window4. Initialize the keyboard function5. Call display function6. Call main loop()

4.2 Algorithm for keyboard function1. Clear the buffer2. Set identity matrix for model view3. Generate a input using the keyboard keys

4.3 Algorithm for character function1. Clear the buffer2. Set identity matrix for model view3. Display the string specified4.4 Functions used in the project4.4.1 Header files used: stdio.h:This header in the C standard library contains macro definitions, constants, and declarations of functions and types used for various standard input and output operations. The name stdio stands for standard library. stdlib.h: Itis the header of the general purpose standard library of C programming language which includes functions involving memory allocation, process control, conversions and others. The name "stdlib" stands for "standard library".

string.h: It is a header file in the standard library of C programming language .In the program for implementing the characters, we used string header file. It is used such as string as str and specified the particular character.

glut.h: It is a library of utilities for OpenGL programs, which primarily perform system-level I/O with the host operating system. Routines for drawing a number of geometric primitives (both in solid and wireframe mode) are also provided, including cubes, spheres, and the Utah teapot. GLUT even has some limited support for creating pop-up menus.

OpenGL Libraries: glu32.lib: The OpenGL Utility Library (GLU) is a computer graphics library. It consists of a number of functions that use the base OpenGL library to provide higher-level drawing routines from the more primitive routines that OpenGL provides. It is usually distributed with the base OpenGL package.Among these features are mapping between screen- and world- coordinates, generation of texture mipmaps, drawing of quadric surfaces, NURBS, tessellation of polygonal primitives, interpretation of OpenGL error codes, an extended range of transformation routines for setting up viewing volumes and simple positioning of the camera, generally in more human-friendly terms than the routines presented by OpenGL. It also provides additional primitives for use in OpenGL applications, including spheres, cylinders and disks. GLU functions can be easily recognized by looking at them because they all have glu as a prefix. An example function is gluOrtho2D( ) which defines a two dimensional orthographic projection matrix. 4.4.3 Description Of The Functions Used :

glBegin and glEnd:

glBegin and glEnd delimit the vertices of a primitive or a group of like primitives. What this means is that every time you want to draw a primitive on the screen you will first have to call glBegin, specifying what kind of primitive it is that you want to draw in the mode parameter of glBegin, and then list all vertices one by one (by sequentially calling glVertex( ) and finally call glEnd( ) to let OpenGL know that you're done drawing a primitive. The parameter mode of the function glBegin can be one of the following: GL_POINTS GL_LINES GL_POLYGON GL_LINE_LOOP

glColor: This function sets the current color. glColor has two major variants: glColor3 and glColor4. glColor3f variants specify new red, green and blue values.

void glutPostRedisplay (): It requests that the display callback be executed after the current callback returns. glutInitWindowSize(int width, int height): It specifies the initial height and weight of the windows in pixel. It is a function used to set the size of the output window. void glutMainLoop(): It causes the program to enter an event processing loop. It is the last statement in main. void glutDisplayFunc(void *(func)(void)): It registers the display function func that is executed when the window needs to be redrawn. void glMatrixMode(GL_PROJECTION): It specifies which matrix will be affected by subsequent transformation.Mode can be GL_MODELVIEW or GL_PROJECTION. glutBitmapCharacter(void *font,int char): It renders the character with ASCII code char at the current raster position using the raster font given by font. void gluOrtho2D(GLint left, GLint right, GLint bottom, GLint top): Defines an orthographic viewing volume with all parameters measured from the center of the projection plane. void glutIdleFunc(void (*f)(int value)) Registers the display callback function, if it is executed whenever there are no other events to be handled. glVertex2f: glVertex2f is used with pseudo-2D sprites or triangles and points that always have to be constrained by the depth coordinate.

4.5 Pseudocode Of Implementation 4.5.1 Module 1 Displays the name of project ,college and credits.Space will lead to next module void myinit(): This is an initialization function that sets the OpenGl state variables. It is used to load the projection matrix using glMatrixMode(GL_PROJECTION). It also sets the camera position using glOrtho(100.0,-100.0,100.0,-100.0,100.0,- 100.0)

void main(): In the main function, interaction between the window system and openGL is initiated by the function glutInit (int *argc, char **argv); The glutInit() function initializes the GLUT library. We can create openGL top-level window using glutCreateWindow("Hot Air Balloon"); We can set the initial window size using glutInitWindowSize (900,700); GlutInitDisplayMode (GLUT_SINGLE| GLUT_RGB|GLUT_DEPTH); The display function is called back using glutDisplayFunc (display) for setting initial display mode. glutMainLoop () is used to enter the GLUT event processing loop. void display(void) function is used to display the cubic blocks and the patterns within the blocks.

4.5.2 Module 2 void draw(): This function is used to draw the mountains, pyramids, lake and the balloon by specifying the different vertex points.

The vertices are defined using the following syntax:

glBegin(TYPE) glVertex2f(x1,y1); glVertex2f(x2,y2); . . . glEnd(); The TYPE can be GL_POLYGON-is used if a color is to be filled into the respective polygon. GL_LINE_LOOP-if color need not be filled into the polygon void keyboard():It is used to display the Enter key position such as: First enter display to the screen1. Second press s to begin the hot air balloon translation.The keys are defined using switch case: void keyboard( unsigned char key, int x, int y) { switch(key) { case 13: if(flag==1) { flag=2; mydisplay(); } if(flag==0) { flag=1; mydisplay(); }break;default:break;}

CHAPTER 5 CONCLUSION AND FUTURE ENHANCEMENT:5.1 Conclusion It was great challenge for us to use OpenGL for the development of our project. With this newly developed software we can use it in the background and does not need any external assistance to maintain it. This project has been developed for the user convenience of the user. We have developed a game containing cubic blocks with patterns which have to be matched within the minimum number of moves, in accordance with VTU specifications. The game is constructed with OpenGL supported function and primitives. We have done our level best and come up with our earnest efforts. Our project becomes useful, as it is user friendly and easy to understand. 5.2 Future Enhancement: Graphics or animation can never be confined to a finite level. Its very vast. The functions employed here are implemented to a limited extent; they have not been used to their fullest. Hence there is a scope for improvement. Over the 40 years history of interactive computer graphics, there have been continuous advancement, but at some stage this progress must terminate with images being sufficiently realistic for all practical purpose. Since in the current technical world animation plays a vital role, we cannot confine ourselves for a particular set of operation or animation functions. Hence the project meets the users basic requirement successfully and is flexible in all respect to one and all.The project can be further developed by adding key function and given an option for the user to select different destinations of the world to which he would prefer to travel to with the translation of the hot air balloon.Blending of colors could be an alternative to make the project brighter.

CHAPTER 6 APPENDIXSOURCE CODE:#include#include#include#include

float red=1.0;float blue=0.0;float green=1.0;int square;GLfloat DEG2RAD=3.1459/180;GLint flag =0;bool updateGeom;void drawBalloon(int y);void frontscreen();void mydisplay();int balloon,screen1;int x,y;GLfloat xbird=500.0,xcloud=500.0,xman=0.0;GLfloat xC1=0.0;int manflag=0;int manheadflag=0;int manjumpflag=0;GLfloat x1=0.0,x2=0.0,x3=0.0,yC1=0.0,yC2=0.0,yC3=0.0;

void frontscreen(void) { int i; glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3d(1.0,0.0,0.0); char c[100]="GOPALAN COLLEGE OF ENGINEERING AND MANAGEMENT"; glColor3f(0.0,0.0,1.0); glRasterPos2d(20,460); for(i=0;i


Recommended