You are on page 1of 8

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM-590 002

MINI PROJECT REPORT ON


“Whirlpool of Colors”
Project Associates:

LINGARAJ V KUDARI (2SR07CS023)


NAYAZ BASHA H.M (2SR07CS032)

Under the Guidance of:


BHAVANA S.PATILB.E,(M.Tech)
SHILPASHREE. S. B.E

Department of Computer Science and Engineering

SRI TARALABALU JAGADGURU INSTITUTE OF TECHNOLOGY


RANEBENNUR-581115, KARNATAKA
S.T.J. INSTITUTE OF TECHNOLOGY
RANEBENNUR - 581115
Department of Computer Science & Engineering
2009-2010
CERTIFICATE

This is to certify that the mini project on “ Whirlpool of Colors” is a bonafide


work carried out by NAYAZ BASHA H.M and LINGRAJ V KUDARI in partial
fulfillment for the award of degree of bachelor of Engineering in Computer
Science and Engineering of the Visvesvaraya Technological University, Belgaum
during the year 2009– 2010.It is certified that all corrections/suggestions indicated for
the internal assessment have been incorporated in the report deposited in the
departmental library. The project report has been approved as it satisfies the academic
requirements in respect of work prescribed for the bachelor of engineering degree.

____________ ______________
Signature of the guide Signature of guide
Shilpashree .S. B E

___________________
Signature of HOD
Prof C. M. Parmeshwarappa

Date: ___________________
Place: STJIT RNR Signature of Examiner
TABLE OF CONTENTS:

CONTENTS

1.INTRODUCTION
1.1 Introduction to OpenGL……………………………….
1.1.1 OpenGL Command Structure…………………….
1.2 Utility Toolkit – Glut……………………………………
1.3 Introduction to Project…………………………………

2. REQUIREMENTS
2.1 Hardware Requirements………………………………
2.2 Software Requirements………………………………..
2.2.1 Introduction about C++ developer………………

3. SPECIFICATION
3.1 Function Specification………………………………..
3.1.1 glutMouseFunc…………………………………...
3.1.2 glutMotionFunc…………………………………..
3.1.3
4. WORKING
4.1Code Explanation…………………………………….

5. APPLICATIONS………………………………………..

6. CONCLUSION………………………………………….

7. BIBLIOGRAPHY………………………………………

Introduction:
• Computer graphics is an interactive method of pictorial
synthesis of real or imaginary objects from their computer
based models. Another closely related term is the “image
processing” which is the analysis of scenes or the
reconstruction of the models of 2D or 3D objects from
their pictures. These are used today in everyday life, be it a
replay in cricket match, advanced graphics in movies or
the daily weather report display on TV.

• OpenGL was developed by ‘Silicon Graphics Inc‘(SGI)


on 1992 and is popular in the gaming industry where it
competes with the Direct3D in the Microsoft Windows
platform. OpenGL is broadly used in CAD (Computer
Aided Design), virtual reality, scientific visualization,
information visualization, flight simulation and video
games development.

• OpenGL is a standard specification that defines an API


that is multi-language and multi-platform and that enables
the codification of applications that output computerized
graphics in 2D and 3D.

• The interface consists in more than 250 different


functions, which can be used to draw complex three-
dimensional scenes with simple primitives. It consists of
many functions that help to create a real world object and
a particular existence for an object can be given.

• OpenGL computer utility kit package where we could


enhance graphics programs on the window system. It
includes all the transformation of the objects from camera
coordinates to screen coordinates. The OpenGL toolkit
includes Clipping, mapping, Translation, Rotation in 2-D
and 3-D viewing window.
SYSTEM SPECIFICATION

 Hardware specification details:

 Processor: Intel 386 onwards Compatible


Hardware
 RAM: 256Mb RAM(minimum)
 Hard Disk:3GB (minimum)
 Monitor:VGA Compatible
 Keyboard: Standard 101 keys keyboard.

 Software Specification Details:

• Operating system : Window XP onwards


• Language Tool: C
• Compiler: visual C++
• Libraries: Supporting glut32.h and 32 bit color
resolution
• Documentation Tool : Ms-word
void mouse(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
lmb = 1;
oldx = x; oldy = y;
}
if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
lmb = 0;
}

if (button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN) {


mmb = 1;
oldx = x; oldy = y;
}
if (button == GLUT_MIDDLE_BUTTON && state == GLUT_UP) {
mmb = 0;
}

void motion(int x, int y)


{
if (lmb) {
ang += ((oldx - x) / 4.0 );
scale += ((oldy - y) / 400.0);

oldx = x; oldy = y;
glutPostRedisplay();
}
if (mmb) {
tx += ((float) (x - oldx)) / 500.0;
ty += ((float) (oldy - y)) / 500.0;

oldx = x; oldy = y;
glutPostRedisplay();
}
}
void grab_screen(void)
{
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, MAXSIZE, MAXSIZE,0);

if (smooth) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,


GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
}
else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
}
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
}

void redraw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(tx, ty, 0.0);
glRotatef(ang, 0.0, 0.0, 1.0);
glScalef(scale, scale, scale);

if (autospin) {
ang = 3.0 * cos(atime);
scale = 1.0 + ( sin(atime / 4.0) * 0.1) ;
atime += 0.01;
}

/* draw feedback square */


glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -1.0);
glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -1.0);
glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0);
glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 1.0);
glEnd();
glDisable(GL_TEXTURE_2D);
/* draw square outline */
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_LOOP);
glVertex2f(-1.0, -1.0);
glVertex2f(1.0, -1.0);
glVertex2f(1.0, 1.0);
glVertex2f(-1.0, 1.0);
glEnd();

/* seed pattern */
glLoadIdentity();
switch(seedmode) {
case 0:
seed();
break;
case 1:
seed_circle();
break;
case 2:
seed_teapot();
break;
case 3:
seed_text(TEXT);
break;
}

void reset(void)
{
ang = 0.0;
scale = 1.0;
tx = ty = 0.0;
autospin = 0;

glClear(GL_COLOR_BUFFER_BIT);
grab_screen();
}

You might also like