0% found this document useful (0 votes)
41 views35 pages

3d Room Scene

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

3d Room Scene

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

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM-590014

A Computer Graphics and Visualization


Mini-Project Report
On
“3D ROOM SCENE”
A Mini-project report submitted in partial fulfilment of the requirements for the award of
the degree of Bachelor of Engineering in Computer Science and Engineering of
Visvesvaraya Technological University, Belgaum.
Submitted by:
RACHANA K (1DT14CS069)
AND
PRAMIT PAUL (1DT14CS066)

Under the Guidance of:


Mr. AMITH R
(Asst. Prof, Dept. of CSE)

Department of Computer Science and Engineering


DAYANANDA SAGAR ACADEMY OF TECHNOLOGY
AND MANAGAEMENT
Kanakapura Road, Udayapura,
Bangalore
2016-2017
DAYANANDA SAGAR ACADEMY OF TECHNOLOGY
AND MANAGEMENT,
Kanakapura Road, Udayapura, Bangalore

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


CERTIFICATE
This is to certify that the Mini-Project on Computer Graphics and Visualization work entitled “3D
ROOM SCENE” has been successfully carried out by RACHANA K (1DT14CS069) and
PRAMIT PAUL (1DT14CS066) bonafide students of Dayananda Sagar Academy of
Technology and Management in partial fulfilment of the requirements for the award of degree in
Bachelor of Engineering in Computer Science and Engineering of Visvesvaraya
Technological University, Belgaum during academic year 2016-2017. It is certified that all
corrections/suggestions indicated for Internal Assessment have been incorporated in the report
deposited in the departmental library. The mini project report has been approved as it satisfies
the academic requirements in respect of project work for the said degree.

Signature of Guide Signature of HOD


Mr. Amith R Dr. C. Nandini
Asst. Prof, Dept. of CSE Vice Principal & Head
DSATM Dept. of CSE, DSATM
Examiners:

1________________________ Signature: _______________________

2________________________ Signature: _______________________


ABSTRACT
In this project, we are implementing a “3D Room Scene” consisting of a Teapot, Table Lamp, a
Laptop, and a Dining Table. There is a 3D wall on which the above mentioned objects are attached.
The objects are placed on slabs with in turn are attached to the wall. The entire 3D scene can be
moved in all the x,y,z directions, and can be viewed accordingly. The Table Lamp can be switched
ON/OFF using the keyboard function. Turning the lamp on illuminates all the objects in the scene.
The 3D Laptop can also be turned ON/OFF. When switched on the laptop screen displays a
Welcome text. The lid of the laptop can also be Opened/Closed, with the help of keyboard
functions. The Teapot is a standard OpenGL teapot placed on the plate. In front of the wall, a
Dining Table is placed, consisting of a table and four chairs. Four plates are also arranged on top of
the table.
ACKNOWLEDGEMENT

It gives us immense pleasure to present before you our project titled “3D ROOM SCENE”. The joy
and satisfaction that accompany the successful completion of any task would be incomplete
without the mention of those who made it possible. We are glad to express our gratitude towards
our prestigious institution DAYANANDA SAGAR ACADEMY OF TECHNOLOGY AND
MANAGEMENT for providing us with utmost knowledge, encouragement and the maximum
facilities in undertaking this project.
We wish to express a sincere thanks to our respected principal Dr. B. R. Lakshmikantha for all his
support.
We express our deepest gratitude and special thanks to Dr. C. Nandini, Prof. & H.O.D, Dept. Of
Computer Science Engineering, for all her guidance and encouragement.
We sincerely acknowledge the guidance and constant encouragement of our mini- project guide,
Assistant Prof. Mr. Amith and Assistant Prof. Mr. Raghu M.T.
RACHANA K (1DT14CS069)
AND
PRAMIT PAUL (1DT14CS066)
3D ROOM SCENE December 30, 1899

TABLE OF CONTENT

1. INTRODUCTION
1.1 Computer Graphics
1.2 OpenGL Technology
1.3 Project Description
1.4 Functions Used
2. REQUIREMENT SPECIFICATION
2.1 Hardware Requirements
2.2 Software Requirements
3. INTERFACE AND ARCHITECTURE
3.1 Interface
3.2 Architecture
4. IMPLEMENTATION
5. SNAPSHOTS
6. CONCLUSION & FUTURE ENHANCMENTS
REFERENCES
APPENDIX
-User Manual
-Personal Details

dept. of cse, dsatm. 5


3D ROOM SCENE December 30, 1899

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 or 3D pattern-recognition abilities allow us to perceive and process
pictorial data rapidly.

Computers have become a powerful medium for the rapid and economical production of
pictures.

Graphics provide a so natural means of communicating with the computer that they have
become widespread.

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

We can make pictures of not only the real world objects but also of abstract objects such
as mathematical surfaces on 4D and of data that have no inherent geometry.

A computer graphics system is a computer system with all the components of the general
purpose computer system. There are five major elements in system: input devices,
processor, memory, frame buffer, output devices.4

FIGURE-1.1:- GRAPHICS SYSTEM

dept. of cse, dsatm. 6


3D ROOM SCENE December 30, 1899

1.2 OpenGL Technology


OpenGL is the premier environment for developing portable, interactive 2D and 3D graphics
applications. Since its introduction in 1992, OpenGL has become the industry's most widely
used and supported 2D and 3D graphics application programming interface (API), bringing
thousands of applications to a wide variety of computer platforms.

OpenGL fosters innovation and speeds application development by incorporating a broad set
of rendering, texture mapping, special effects, and other powerful visualization functions.
Developers can leverage the power of OpenGL across all popular desktop and workstation
platforms, ensuring wide application deployment.

OpenGL Available Everywhere: Supported on all UNIX® workstations, and shipped standard
with every Windows 95/98/2000/NT and Mac OS PC, no other graphics API operates on a
wider range of hardware platforms and software environments.

OpenGL runs on every major operating system including Mac OS, Windows (All Versions),
Linux, Open Step, and BeOS; it also works with every major windowing system, including
Win32, Mac OS, Presentation Manager, and X-Window System. OpenGL is callable from
Ada, C, C++, FORTRAN, Python, Perl and Java and offers complete independence from
network protocols and topologies.

FIGURE 1.2-OPENGL PIPELINE

dept. of cse, dsatm. 7


3D ROOM SCENE December 30, 1899

1.3 Project Description:

In this project, we are implementing a “3D Room Scene” consisting of a Teapot, Table Lamp, a
Laptop, and a Dining Table. There is a 3D wall on which the above mentioned objects are
attached. The objects are placed on slabs with in turn are attached to the wall. The entire 3D
scene can be moved in all the x,y,z directions, and can be viewed accordingly. The Table Lamp
can be switched ON/OFF using the keyboard function. Turning the lamp on illuminates all the
objects in the scene. The 3D Laptop can also be turned ON/OFF. When switched on the laptop
screen displays a Welcome text. The lid of the laptop can also be Opened/Closed, with the help
of keyboard functions. The Teapot is a standard OpenGL teapot placed on the plate.

In front of the wall, a Dining Table is placed, consisting of a table and four chairs. Four plates
are also arranged on top of the table.

The controls are as follows-

w, s, a, d for Rotation.

'l' for toggling Light.

'o ' for turning laptop ON.

'x' and 'y' for laptop lid (UP/DOWN).

1.4Functions Used:

This project is developed using Code::Blocks and this project is implemented by making
extensive use of library functions offered by graphics package of OpenGl, a summary of those
functions follows:

glBegin() :

Specifies the primitives that will be created from vertices presented between glBegin and
subsequent glEnd. GL_POLYGON, GL_LINE_LOOP etc.

glEnd(void) :

It ends the list of vertices.

dept. of cse, dsatm. 8


3D ROOM SCENE December 30, 1899

glPushMatrix() :

void glPushMatrix( void )

glPushMatrix pushes the current matrix stack down by one level, duplicating the current
matrix.

glPopMatrix() :

void glPopMatrix( void )

glPopMatrix pops the top matrix off the stack, destroying the contents of the popped
matrix. Initially, each of the stacks contains one matrix, an identity matrix.

glTranslate() :

void glTranslate( GLdouble x, GLdouble y,GLdouble z )

Translation is an operation that displaces points by a fixed distance in a given direction.


Parameters x, y, z specify the x, y, and z coordinates of a translation vector. Multiplies
current matrix by a matrix that translates an object by the given x, y and z-values.

glClear() :

void glClear(GLbitfield mask)

glClear takes a single argument that is the bitwise or of several values indicating which
buffer is to be cleared.

GL_COLOR_BUFFER_BIT,GL_DEPTH_BUFFER_BIT,GL_ACCUM_ BUFFER_BIT,
and GL_STENCIL_BUFFER_BIT. Clears the specified buffers to their current clearing
values.

glClearColor() :

void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)

Sets the current clearing color for use in clearing color buffers in RGBA mode. The red,
green, blue, and alpha values are clamped if necessary to the range [0, 1]. The default
clearing color is (0, 0, 0, 0), which is black.

dept. of cse, dsatm. 9


3D ROOM SCENE December 30, 1899

glMatrixMode() :

void glMatrixMode (GLenum mode)

It accepts three values GL_MODELVIEW, GL_PROJECTION and GL_TEXTURE. It


specifies which matrix is the current matrix. Subsequent transformation commands affect
the specified matrix.

glutInitWindowPosition() :

void glutInitWindowPosition(int x, int y);

This API will request the windows created to have an initial position. The arguments x, y
indicate the location of a corner of the window, relative to the entire display.

glLoadIdentity() :

void glLoadIdentity(void);

It replaces the current matrix with the identity matrix

glutInitWindowSize() :

void glutInitWindowSize(int width, int height);

The API requests windows created to have an initial size. The arguments width and
height indicate the window’s size (in pixels). The initial window size and position are
hints and may be overridden by other requests.

glutInitDisplayMode () :

void glutInitDisplayMode (unsigned int mode );

Specifies the display mode, normally the bitwise OR-ing of GLUT display mode bit
masks. This API specifies a display mode (such as RGBA or color-index, or single or
double-buffered) for windows.

glFlush() :

void glFlush(void);

The glFlush function forces execution of OpenGL functions in finite time.

dept. of cse, dsatm. 10


3D ROOM SCENE December 30, 1899

glutCreateWindow() :

int glutCreateWindow(char *name);

The parameter name specifies any name for window and is enclosed in double quotes.
This opens a window with the set characteristics like display mode, width, height, and so
on. The string name will appear in the title bar of the window system. The value returned
is a unique integer identifier for the window. This identifier can be used for controlling
and rendering to multiple windows from the same application.

glutDisplayFunc() :

void glutDisplayFunc(void (*func)(void))

Specifies the new display callback function. The API specifies the function that’s called
whenever the contents of the window need to be redrawn. All the routines need to be
redraw the scene are put in display callback function.

glVertex2f() :

void glVertex2f(GLfloat x,GLfloat y)

x Specifies the x-coordinate of a vertex.

y Specifies the y-coordinate of a vertex.

The glVertex function commands are used within glBegin/glEnd pairs to specify point,
line, and polygon vertices. The current color, normal, and texture coordinates are
associated with the vertex when glVertex is called. When only x and y are specified, z
defaults to 0.0 and w defaults to 1.0. When x, y, and z are specified, w defaults to 1.0.

void keyboard (unsigned char key, int x, int y) :

This function specifies the keys to be pressed to manipulate the object displayed and the
output window.

dept. of cse, dsatm. 11


3D ROOM SCENE December 30, 1899

glutMainLoop(void) :

glutMainLoop enters the GLUT event processing loop. These routines should be called at
most once in the GLUT program. Once called, these routine will never exit. It will call all
the necessary call back functions that have been registered.

void inputKey(unsigned char, int x, int y) :

This function is used to make responds to the keys that are pressed from the keyboard.

In this project, these keyboard keys are used to switch on the kit, to choose different
gates, etc.

glColor3f
void glColor3f(GLfloat red, GLfloat green, GLfloat blue);

PARAMETERS:

1. Red: The new red value for the current color.

2. Green: The new green value for the current color.

3. Blue: The new blue value for the current color.

Sets the current color.

glRotate():

void glRotate( GLfloat angle, GLfloat x, GLfloat y, GLfloat z);

PARAMETERS:

angle: The angle of rotation, in degrees.

x: The x coordinate of a vector.

y: The y coordinate of a vector.

z: The z coordinate of a vector.

The glRotated and glRotatef functions multiply the current matrix by a rotation matrix.

dept. of cse, dsatm. 12


3D ROOM SCENE December 30, 1899

gluPerspective():
void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble
zFar);

PARAMETERS:
fovy : Specifies the field of view angle, in degrees, in the y
direction.
aspect: Specifies the aspect ratio that determines the field of view in the x direction.
The aspect ratio is the ratio of x (width) to y (height).
zNear: Specifies the distance from the viewer to the near clipping plane (always
positive).
zFar : Specifies the distance from the viewer to the far clipping plane (always positive).
Sets up a perspective projection matrix.
glMaterialfv():
void glMaterialfv(GLenum face, GLenum pname, const GLfloat params);

PARAMETERS:

face: The face or faces that are being updated. Must be one of the following:
GL_FRONT, GL_BACK, or GL_FRONT and GL_BACK.

Pname: The material parameter of the face or faces being updated. The
parameters that can be specified using glMaterialfv, and their interpretations by
the lighting equation, are as follows.

GL_SPECULAR: The params parameter contains four integer or floating-point


values that specify the seculars RGBA reflectance of the material. Integer values
are mapped linearly such that the most positive represent able value maps to 1.0,
and the most negative represent able value maps to -1.0. Floating-point values are
mapped directly. Neither integer nor floating-point values are clamped. The
default specular reflectance for both front-facing and back-facing materials is
(0.0, 0.0, 0.0, 1.0).

The glMaterialfv function specifies material parameters for the lighting model.

dept. of cse, dsatm. 13


3D ROOM SCENE December 30, 1899

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

PARAMETERS:

argcp : A pointer to the program's unmodified argc 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 unmodified argv variable from main. Like argcp, the data for
argv will be updated because glutInit extracts any command line options
understood by the GLUT library.

glutInit(&argc,argv);

glutInit is used to initialize the GLUT library.

glutMainLoop ():
void glutMainLoop();
glutMainLoop() enters the glut event
processing loop.
glLightfv():
void glLightfv(GLenum light, GLenum pname, GLfloat *params);

The glLightfv function returns light source parameter values.

PARAMETERS:

Light: The identifier of a light. The number of possible lights depends on the
implementation, but at least eight lights are supported. They are identified by symbolic
names of the form GL_LIGHTi where i is a value: 0 to GL_MAX_LIGHTS - 1.

Pname: A light source parameter for light. The following symbolic names are accepted:

GL_DIFFUSE: The params parameter contains four integer or floating-point values that
specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such
that the most positive represent able value maps to 1.0, and the most negative represent
able value maps to 1.0. Floating-point values are mapped directly. Neither integer nor

dept. of cse, dsatm. 14


3D ROOM SCENE December 30, 1899

floating-point values are clamped. The default diffuse intensity is (0.0, 0.0, 0.0, 1.0) for
all lights other than light zero. The default diffuse intensity of light zero is (1.0, 1.0, 1.0,
1.0).

GL_SPECULAR: The params parameter contains four integer or floating-point values


that specify the specular RGBA intensity of the light. Integer values are mapped linearly
such that the most positive represent able value maps to 1.0, and the most negative
represent able value

maps to 1.0. Floating-point values are mapped directly. Neither integer nor floating-point
values are clamped. The default specular intensity is (0.0, 0.0, 0.0, 1.0) for all lights other
than light zero. The default specular intensity of light zero is (1.0, 1.0, 1.0, 1.0).

GL_AMBIENT: The params contains four integer or floating-point values that specify
the ambient RGBA intensity of the light. Integer values are mapped linearly such that the
most positive represent able value maps to 1.0, and the most negative representable value
maps to -1.0 . Floating-point values are mapped directly. Neither integer nor floating-
point values are clamped. The initial ambient light intensity is (0,0, 0, 1).

glEnable():

void glEnable(GLenum cap);

glEnable(GL_CULL_FACE);
PARAMETERS:

cap: A symbolic constant indicating an OpenGL capability.

The glEnable enable OpenGL capabilities.

glDisable():

This function disables various capabilities in opengl

glDisable(GL_LIGHT0);

glDisable(GL_LIGHTING);

dept. of cse, dsatm. 15


3D ROOM SCENE December 30, 1899

glDisable(GL_LIGHT1);

Display Function:

void display() :

In this function, rotation, translation and scaling is done by pushing and popping the
matrix and using the inbuilt glutSolid function. We draw the helicopter, human and
clouds.

Main Function:

int main(int argc, char *argv[]) :

In this function, we are creating the window, enabling the mouse and keyboard
functions, initializing the display mode and also enables the 3D view.

User Defined Functions:


void lamp():

In this function glutSolidCube() and glutWireSphere() are used to create lamp.

void table():

In this function glutSolidCube() is used to create table and chairs.

display lid():

In this function the screen(lid) of the laptop is designed .

void draw():

In this function we create the keys and outlook of the laptop.

dept. of cse, dsatm. 16


3D ROOM SCENE December 30, 1899

dept. of cse, dsatm. 17


3D ROOM SCENE December 30, 1899

Chapter-2

REQUIREMENTS SPECIFICATION
2.1 Hardware requirements:

Intel Pentium or higher processor/AMD processor.

128 MB or more RAM.

A standard keyboard, and Microsoft compatible mouse.

CRT monitor/LCD or LED display.

2.2 Software requirements:

The graphics package has been designed for OpenGL; hence the machine must

Have Dev C++.

Software installed preferably 6.0 o r l a t e r v e r s i o n s with mouse driver installed.

Operating System: Windows.

Version of Operating System: Windows XP, Windows NT and Higher.

Language: C.

dept. of cse, dsatm. 18


3D ROOM SCENE December 30, 1899

Chapter-3

INTERFACE AND ARCHITECTURE


3.1 Interface
KEYBOARD FUNCTIONS:

w, s, a, d keys- Turns the towards left, right, up and bottom respectively.

'l' key- Used for toggling Light of the table lamp.

'o ' key- Used for turning laptop ON/OFF.

'x' and 'y' keys- Used for Opening/Closing the laptop lid.

3.2 Architecture

CONTROL FLOW DIAGRAM

dept. of cse, dsatm. 19


3D ROOM SCENE December 30, 1899

Chapter-4

IMPLEMENTATION

This project is implemented using GLUT functions. The keyboard functions are used to control
the viewing directions and motions

The Table lamp is used to switch ON/OFF which illuminates the light on different objects.
The functions used to design the 3D Room Scene is given below-

Code to draw the table lamp:

void lamp()

glPushMatrix();

glColor3f(1.0,1.0,0.0);

glScaled(0.35,0.25,0.35);

glTranslated(-9.7,16,3.7);

glRotated(180,0,1,1);

glutWireSphere(2,60,4);

glPopMatrix();

glPushMatrix();

glColor3f(0.0,0.0,0.0);

glTranslated(-3.4,3.15,1.3);

glutSolidCube(0.8);

glPopMatrix();

dept. of cse, dsatm. 20


3D ROOM SCENE December 30, 1899

glPushMatrix();

glColor3f(1.0,1.0,0.0);

glScaled(0.42,1.3,0.4);

glTranslated(-8.1,3,3.2);

glutSolidSphere(0.3,20,20);

glPopMatrix();

glPushMatrix();

glColor3f(0.5,0.8,0.8);

glTranslated(-3.1,3,1.7);

glScaled(1.0,2,0.5);

glutSolidCube(0.1);

glPopMatrix();

Code to draw the 3D Laptop:

void laptopDraw(){

draw();

paneldraw();

display_lid();
}

draw() is used to create the outer body of the laptop,

paneldraw() is used to create the inner body of the laptop including the keypad, and

display_lid() is used to create the lid of the laptop.

Code to animate the laptop using keyboard functions:

dept. of cse, dsatm. 21


3D ROOM SCENE December 30, 1899

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

if(key=='w')

glRotatef(10, 1.0, 0.0, 0.0);

glutPostRedisplay();

else

if(key=='s')

glRotatef(-10, 1.0, 0.0, 0.0);

glutPostRedisplay();

else

if(key=='a')

glRotatef(-10, 0.0, 1.0, 0.0);

glutPostRedisplay();

else

if(key=='d')

glRotatef(10, 0.0, 1.0, 0.0);

dept. of cse, dsatm. 22


3D ROOM SCENE December 30, 1899

glutPostRedisplay();

else

if(key=='l')

if(lightFlag == 1){

glDisable(GL_LIGHT0);

lightFlag = 0;

glutPostRedisplay();

else{

glEnable(GL_LIGHT0);

lightFlag = 1;

glutPostRedisplay();

else if(key == 'x')

angle1-=5;

if(angle1<=80) angle1=80;

if(angle1<=130) lidFlag1=0;

glutPostRedisplay();

dept. of cse, dsatm. 23


3D ROOM SCENE December 30, 1899

else if(key == 'y')

angle1+=5;

if(angle1>=180) angle1=180;

if(angle1>=130) lidFlag1=1;

glutPostRedisplay();

else if(key == 'o')

if(onFlag == 0){

onFlag = 1;

welcomeflag = 0;

glutPostRedisplay();

else{

onFlag = 0;

glutPostRedisplay();

Code for displaying the 3D Room Scene:

void display(void)

dept. of cse, dsatm. 24


3D ROOM SCENE December 30, 1899

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };


const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };

const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };

const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };

const GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f };

const GLfloat mat_diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };

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

const GLfloat high_shininess[] = { 100.0f };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);

glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);

glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);

glLightfv(GL_LIGHT0, GL_POSITION, light_position);

glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);

glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);

glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);

glPushMatrix();

glScalef(50,50,50);

dept. of cse, dsatm. 25


3D ROOM SCENE December 30, 1899

glTranslatef(0,-1,-1);

glPushMatrix();

glColor3f(1,1,1);

glScaled(9.5,6.5,0.25);

glTranslated(0.0,0.3,0.0);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

glColor3f(0,0,0);

glScaled(9.5,0.2,0.3);

glTranslated(0.0,-7.05,0.0);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

glColor3f(0,0,0);

glScaled(9.5,0.2,0.3);

glTranslated(0.0,26,0.0);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

dept. of cse, dsatm. 26


3D ROOM SCENE December 30, 1899

glColor3f(1,0,0);

glScaled(2.5,0.15,2.5);

glTranslated(0,8,0.5);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

glColor3f(1,0,0);

glScaled(2.5,0.15,2.5);

glTranslated(-1.4,18,0.5);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

glColor3f(1,0,0);

glScaled(2.5,0.15,2.5);

glTranslated(1.4,-0.6,0.5);

glutSolidCube(1);

glPopMatrix();

glPushMatrix();

glColor3f(1.8,1.5,0.0);

glTranslated(3.5,0.36,1.4);

dept. of cse, dsatm. 27


3D ROOM SCENE December 30, 1899

glutSolidTeapot(0.5);

glPopMatrix();

glPushMatrix();

lamp();

glPopMatrix();

glPopMatrix();

glPushMatrix();

glTranslatef(-100,-27,90);

laptopDraw();

glPopMatrix();

glPushMatrix();

table();

glPopMatrix();

glFlush();

glutSwapBuffers();

dept. of cse, dsatm. 28


3D ROOM SCENE December 30, 1899

Chapter-5
SNAPSHOTS

Snapshot: Front View

Snapshot: Top View

dept. of cse, dsatm. 29


3D ROOM SCENE December 30, 1899

Snapshot: Back View; Dining Table

Snapshot: Laptop turned ON

dept. of cse, dsatm. 30


3D ROOM SCENE December 30, 1899

Snapshot: Laptop lid half closed/ opened

Snapshot: Laptop lid full closed

dept. of cse, dsatm. 31


3D ROOM SCENE December 30, 1899

Snapshot: Table Lamp turned OFF, Light Disabled

dept. of cse, dsatm. 32


3D ROOM SCENE December 30, 1899

Chapter-6
CONCLUSION AND FUTURE ENHANCEMENT
Conclusion:

Using OpenGL we thus created and implemented "3D Room Scene". The Project has been
developed as per requirements specified by the Visvesvaraya Technological University as a
partial fulfillment of the Computer Graphics Lab for 6th Semester, Computer Science and
Engineering. All the requirements given have been implemented in the project. This project
makes use of various functions provided by OpenGL. Doing this project has helped us
understand and implement the concepts of OpenGL.

The future enhancements are as follows:

1. The above project can be implemented in a better way in the form of a complete room.
2. We can add more walls and doors to the room, and objects inside the room like,
cupboards, ceiling fan, etc.
3. Similarly, by making more than one room, we can implement a 3D house.

dept. of cse, dsatm. 33


3D ROOM SCENE December 30, 1899

REFERENCES

Books:

[1]. Edward Angel-”Interactive Computer Graphics: A Top-Down Approach using OpenGL”,


5th

Edition, Addison-Wesley, 2008.

Websites:

[1]. www.opengl.org/resources/libraries

[2]. www.openglforum.com

dept. of cse, dsatm. 34


3D ROOM SCENE December 30, 1899

APPENDIX

User Manual:

w, s, a, d for Rotation.

'l' for toggling Light.

'o ' for turning laptop ON.

'x' and 'y' for laptop lid (UP/DOWN)

Personal Details

NAME: RACHANA K (1DT14CS069) & PRAMIT PAUL (1DT14CS066).

SEMESTER AND SECTION: 6B.

DEPARTMENT: COMPUTER SCIENCE AND ENGINEERING

COLLEGE: DAYANANDA SAGAR ACADEMY OF


TECHNOLOGY AND MANAGEMENT

EMAIL ID: [email protected] & [email protected] .

dept. of cse, dsatm. 35

You might also like