-
1
VISVESVARAYA TECHNOLOGICAL UNIVERSITY,
BELGAUM
A PROJECT REPORT ON
Effect of lighting on solids
Submitted in partial fulfillment of the requirements of the
Award of degree of
BACHELOR OF ENGINEERING IN
COMPUTER SCIENCE & ENGINEERING By
K R ANAND 4VV11CS019
SHANTHARAJU N 4VV11CS051
UNDER THE GUIDANCE OF
Mrs. Sunita B.K., M.Tech
Assistant Professor, Department of Computer Science &
Engineering
VVCE, Mysore
2012-2013
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
VIDYAVARDHAKA COLLEGE OF ENGINEERING
MYSORE
Vidyavardhaka College of Engineering
Gokulum 3rd Stage,
Mysore-570002
Department of Computer Science and Engineering
-
2
This is to certify that the Project entitled Lighting effect on
solids is a bonafide
work carried out by K R Anand (4VV11CS019) and Shantharaju N
(4VV11CS051) of
6th semester Computer Science and Engineering as prescribed by
Visvesvaraya
Technological University Belgaum, during the academic year
2012-2013.
It is certified that all the suggestions and corrections
indicated for the internal
assessment have been incorporated in the report deposited in the
department library.
The project report has been approved as it satisfies the
requirements in respect of project
work prescribed for the said degree.
Signature of Guide Signature of HOD Signature of Principal
------------------------- ------------------------
----------------------------
Mrs. Sunita B.K Prof. Dr.Yuvaraju B.N Dr.B.Sadashive Gowda
(Asst. Prof., Dept CSE) (HOD, Dept CSE) (Principal, VVCE,
Mysore)
Name of the examiners
1)
2)
3)
-
3
ACKNOWLEDGEMENT
If words are considered as the tokens of acknowledges, then the
words play the
heralding role of expressing my gratitude.
With proud gratitude we thank God Almighty for all the blessings
showered on me and
for completing my project successfully.
We owe our gratitude to The Principal, Dr. B Sadashive Gowda for
his whole hearted
support and for his kind permission to undergo the project.
We wish to express our deepest gratitude to Prof. Dr. Yuvaraju
B.N, Head of
Department, Computer Science and Engineering, VVCE, for her
profound alacrity
in our project and his valuable suggestions.
We wish to enunciate our special thanks to our paradigmatic and
relevant internal
guide Mrs. Sunita B.K, Assistant Professor in Computer Science
and Engineering,
VVCE who gave us throughout our project period with their
valuable suggestions and
for devoting their precious time in making this project a
success.
In the end, we are anxious to offer our sincere thanks to our
family members and
friend for their valuable suggestions, encouragement and
unwavering supports.
K R Anand
Shantharaju N
-
4
TABLE OF CONTENT
-
5
CHAPTER - 1
INTRODUCTION
1.1 Overview of Computer Graphics
Computer Graphics is concerned with all aspects of producing
pictures or images using
computer. These are intentionally fashioned to achieve some
visual effects. Computer
Graphics also refers to the tools used to make such pictures.
There are both hardware and
software tools.
Hardware tools include video monitors and printers that display
graphics, and input
devices like a mouse or track ball. Software tools are editors,
compilers, debugger found
in any programming environment.
Interactive computer graphics is the most important means of
producing pictures since the
invention of photography and television. A picture is worth ten
thousand words.
Interactive computer graphics thus permits extensive,
high-bandwidth user-computer
interaction.
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.
Computer Graphics has become a powerful tool for the rapid and
economical production
of pictures. There is virtually no area in which Graphical
displays cannot be used to some
advantage so it is not surprising to find the use of Computer
Graphics so widespread.
1.2 History of Computer Graphics
This field began humbly almost 50 years ago, with display of a
few lines on a cathode ray
tube. William fetter was credited with coining the term Computer
Graphics in 1960, to
describe his work at Boeng. One of the first displays of
computer animation was future
world (1976), which included an animation of a human face and
hand-produced by
Carmull and Fred Parkle at the University of Utah.
There are several international conferences and journals where
the most significant results
in computer-graphics are published. Among them are the SIGGRAPH
and Euro graphics
-
6
conferences and the association for computing machinery (ACM)
transaction on Graphics
journals.
1.3 Application of Computer Graphics
The applications of computer graphics are many and varied;
however, we can divide them
into four major areas as described:
1.3.1 Display of information
Classical graphics techniques arose as a medium to convey
information among people.
Although spoken and written languages serve a similar purpose,
the human visual system
is unrivaled both as a processor of data and as a pattern
recognizer. Today, architects,
mechanical designers, generate the same type of information and
drafts people-using
computer based drafting systems.
For centuries, cartographers have developed maps to display
celestial and geographical
information, which were crucial for navigators. Now, maps can be
developed and
manipulated in real time over internet.
Medical imaging poses interesting and important data analysis
problems. Modern
imaging technologies such as computed tomography (CT), magnetic
resonance imaging
(MRI), ultrasound, and positron emission tomography (PET)
generate three-dimensional
data that must be subjected t algorithmic manipulation to
provide useful information.
Supercomputers now allow researchers in many areas to solve
previously intractable
problems. In fields such as fluid flow, molecular biology, and
mathematics, images
generated by conversion of data to geometric entities that can
be displayed have yielded
new insights into complex processes.
1.3.2 Design
Professions such as engineering and architecture are concerned
with design. Starting
with a set of specifications, engineers and architects seek a
cost effective and esthetic
solution that satisfies the specifications.
Design is an iterative process. Design problems are either over
determined, such that
they possess no solution that satisfies all criteria, much less
an optimal solution, or
underdetermined, such that they have multiple solutions that
satisfy the design criteria.
Thus, the designer works iteratively by generating a possible
design, testing it, and then
using the results as the basis for exploring other
solutions.
-
7
The use of interactive graphical tools in computer aided design
(CAD) pervades fields
including as architectures, mechanical engineering, the design
of very-large scale
integrated (VLSI) circuits, and the creation of characters for
animations. In all these
applications, the graphics are used in a number of distinct
ways.
1.3.3 Simulation and Animation
In real time, graphics systems are used as simulators. One of
the most important uses
has been in the training of pilots. Graphical flight simulators
have proved to increase
safety and to reduce training expenses.
Games and educational software for home computers are almost as
impressive. The
simulator can be used for designing the robot, planning its
path, and simulating its
behavior in complex environments.
Computer graphics is being widely used for animation in the
television, motion picture,
and advertising industries. Computers at a cost less than that
of movies made with
traditional hand-animation techniques can now make entire
animated movies.
The field of virtual reality (VR) has opened many new horizons.
A human viewer can be
equipped with a display headset that allows him to see separate
images with his right and
left eye, which gives the effect of stereoscopic vision.
1.3.4 User interface
Our interaction with computers has become dominated by a visual
paradigm that
includes windows, icons, menus, and a pointing device, such as
mouse. From a user's
perspective, windowing systems such as X Window System,
Microsoft Windows, and the
Macintosh OS X differ only in details.
More recently, millions of people have become Internet users.
Their access is through
graphical network browsers, such as Firefox and Internet
Explorer that use these same
interface tools. We are so accustomed to this style of interface
that we often forget that
we are working with computer graphics.
Now a days even school children are comfortable with interactive
graphics techniques,
such as the desktop metaphor for window manipulation and menu
and icons selection
with mouse. Graphics based user interfaces have made productive
users of neophytes, and
the desk without its graphics computer is increasingly rare.
-
8
1.4 Statement of the Project
Our statement of the project is "Effect of lighting on solids".
The concerning work is
achieved by using computer graphics and its standard functions
defined in
OpenGL package using Microsoft visual C++.
1.5 Objective of the Project
The aim of our project is to develop a program, which shows the
effect of lighting on
solids.
The main mode of input or interaction with the user is through
the mouse.
1.6 Organization of the Report
Chapter 1 introduces the computer graphics and its
applications.
Chapter 2 contains the basic concepts and principle involved in
OpenGL.
Chapter 3 deals with Basic Concepts of a lighting.
Chapter 4 Deals with design and implementation and function
related to the project.
Chapter 5 contains the snapshots and the result regarding
project.
Chapter 6 concludes the project and mentions the future
scope.
-
9
CHAPTER - 2
INTRODUCTION TO OPENGL
2.1 Introduction
OpenGL (Open Graphics Library) is a standard specification
defining a cross-language,
cross-platform API for writing applications that produce 2D and
3D computer graphics.
OpenGL is not a programming language it is an API (Application
Programming
Interface). The interface consists of many different function
calls which can be used for
building application programs.
OpenGL is widely used in CAD, virtual reality, scientific
visualization, information
visualization, and flight simulation.
OpenGL is portable to many platforms (windows, MAC, UNIX, LINUX)
and callable
from many programming languages (C/C++, JAVA, PEARL). OpenGL is
primarily
concerned with modeling and rendering operations such as, to
specify geometric
primitives (lines, pixels, polygons...), apply geometric
transformations and specify
camera light, color, texture information etc.
All functions in OpenGL library are device independent, many
operations (windowing,
I/O etc.) are not included in basic core library, and so
different auxiliary libraries are
-
10
developed for features not available in OpenGL. OpenGL libraries
are OpenGL:
GL (lib GL) and GLU (lib GLU). These are windows native
implementation (OpenGL32)
and Mesa3D: free ware implementation for LINUX. GLUT: OpenGL
utility tool kit (lib
glut) the GLUT library is responsible for window and menu
management, mouse and
keyboard interactions.
Graphics libraries are GLUI: GLUT based user interface library
(lib glui) -It controls
OpenGL applications such as buttons, check boxes, radio buttons
etc.
Most of our application will be designed to access OpenGL
directly through functions in
three libraries. Functions in the main GL (or OpenGL in windows)
library have names
that begin with the letters gl and are stored in a library
usually referred to as GL (or
OpenGL in windows).
The second is the OpenGL Utility Library (GLU). This library
uses only GL functions but
contains code for creating common objects and simplifying
viewing. All functions in
GLU can be created from the core GL library but application
programmers prefer not to
write the code repeatedly. The GLU library is available in all
OpenGL implementations;
functions in the GLU library begin with letters glu.
To interface with the window system and to get input from
external devices into our
programs, we need at least one more library. For each major
window system there is a
system specific library that provides the "glue" between the
window system and OpenGL.
For the X window system, this library is called GLX, for
windows, it is wgl, and for the
Macintosh, it is agl.
Rather than using a different library for each system, we use a
readily available library
called the OpenGL Utility Toolkit (GLUT), which provides the
minimum functionality
that should be expected in any modern windowing system.
Figure 2.2 shows the organization of the libraries for an X
Window System environment.
-
11
For this window system, GLUT will use GLX and the X libraries.
The application
program, however, can use only GLUT functions and thus can be
recompiled with the
GLUT library for other window systems.
OpenGL makes heavy use of macros to increase code readability
and avoid the use of
magic numbers. Thus strings such as GL_FILL and GL_POINTS are
defined in header
files. In most implementations, one of the include lines
#include
Or
#include
is sufficient to read in glut.h, gl.h, and glu.h.
2.2 Why OpenGL
The intention of this chapter is to give you basic concepts in
OpenGL. OpenGL is a
device and operating system independent library for 3D-graphics
and rendering. OpenGL
was originally developed by Silicon Graphics Inc (SGI) for use
on their high end graphics
workstations. Since then, OpenGL has become a widely accepted
standard with
implementations on many operating system and hardware platforms
including Windows
NT and Windows X operating systems.
The purpose of the OpenGL library is to render two and three-
dimensional objects into
frame buffer. OpenGL is a library of high-quality
three-dimensional graphics and
rendering functions. The library's device- and
platform-independence make it a library of
choice for developing portable graphical applications.
OpenGL drawings are constructed from primitives; primitives are
simple items such as
lines or polygons, which in turn are composed of vertices.
The OpenGL Library assembles primitives from vertices while
taking into account a
variety of settings, such as color, lighting, and texture.
Primitives are then processed in
accordance with transformations, clipping settings, and other
parameters; at the end of the
rasterization, process is pixel data deposited into a frame
buffer.
Because of high visual quality and performance, any visual
computing application
requiring maximum performance-from 3D animation to CAD to visual
simulation-can
-
12
exploit high-quality, high-performance OpenGL capabilities.
These capabilities allow
developers in diverse markets such as broadcasting, CAD/CAM/CAE,
entertainment,
medical imaging, and virtual reality to produce and display
incredibly compelling 2D and
3D graphics.
2.3 Advantages of Using OpenGL
Industry standard: An independent consortium, the OpenGL
Architecture Review
Board, guides the OpenGL specification. With broad industry
support, OpenGL is the
only truly open, vendor-neutral, multiplatform graphics
standard.
Stable: OpenGL implementations have been available for more than
seven years on a
wide variety of platforms. Additions to the specification are
well controlled, and proposed
updates are announced in time for developers to adopt changes.
Backward compatibility
requirements ensure that existing applications do not become
obsolete.
Reliable and portable: All OpenGL applications produce
consistent visual display
results on any OpenGL API-compliant hardware, regardless of
operating system or
windowing system.
Evolving: Because of its thorough and forward-looking design,
OpenGL allows new
hardware innovations to be accessible through the API via the
OpenGL extension
mechanism. In this way, innovations appear in the API in a
timely fashion, letting
application developers and hardware vendors incorporate new
features into their normal
product release cycles.
-
13
CHAPTER - 3
BASIC CONCEPTS OF LIGHTING
OpenGL approximates light and lighting as if light can be broken
into red, green, and
blue components. Thus, the color of light sources is
characterized by the amount of red,
green, and blue light they emit, and the material of surfaces is
characterized by the
percentage of the incoming red, green, and blue components that
is reflected in various
directions. The OpenGL lighting equations are just an
approximation but one that works
fairly well and can be computed relatively quickly. If you
desire a more accurate (or just
different) lighting model, you have to do your own calculations
in software. Such
software can be enormously complex, as a few hours of reading
any optics textbook
should convince you.
In the OpenGL lighting model, the light in a scene comes from
several light sources that
can be individually turned on and off. Some light comes from a
particular direction or
position, and some light is generally scattered about the scene.
For example, when you
turn on a light bulb in a room, most of the light comes from the
bulb, but some light
comes after bouncing off one, two, three, or more walls. This
bounced light (called
ambient) is assumed to be so scattered that there is no way to
tell its original direction, but
it disappears if a particular light source is turned off.
Finally, there might be a general ambient light in the scene
that comes from no particular
source, as if it had been scattered so many times that its
original source is impossible to
determine.
In the OpenGL model, the light sources have an effect only when
there are surfaces that
absorb and reflect light. Each surface is assumed to be composed
of a material with
various properties. A material might emit its own light (like
headlights on an automobile),
-
14
it might scatter some incoming light in all directions, and it
might reflect some portion of
the incoming light in a preferential direction like a mirror or
other shiny surface.
The OpenGL lighting model considers the lighting to be divided
into four independent
components: emissive, ambient, diffuse, and specular. All four
components are computed
independently and then added together.
3.1 Ambient, Diffuse, and Specular Light
3.1.1 Ambient
Ambient illumination is light that's been scattered so much by
the environment that its
direction is impossible to determine - it seems to come from all
directions. Backlighting
in a room has a large ambient component, since most of the light
that reaches your eye
has first bounced off many surfaces. A spotlight outdoors has a
tiny ambient component;
most of the light travels in the same direction, and since
you're outdoors, very little of the
light reaches your eye after bouncing off other objects. When
ambient light strikes a
surface, it's scattered equally in all directions.
3.1.2 Diffuse
The diffuse component is the light that comes from one
direction, so it's brighter if it
comes squarely down on a surface than if it barely glances off
the surface. Once it hits a
surface, however, it's scattered equally in all directions, so
it appears equally bright, no
matter where the eye is located. Any light coming from a
particular position or direction
probably has a diffuse component.
3.1.3 Specular
Finally, specular light comes from a particular direction, and
it tends to bounce off the
surface in a preferred direction. A well-collimated laser beam
bouncing off a high-quality
mirror produces almost 100 percent specular reflection. Shiny
metal or plastic has a high
specular component, and chalk or carpet has almost none. You can
think of specularity as
shininess.
-
15
3.2 Coding
3.2.1 Light Sources
Although a light source delivers a single distribution of
frequencies, the ambient, diffuse,
and specular components might be different. For example, if you
have a white light in a
room with red walls, the scattered light tends to be red,
although the light directly striking
objects is white.
OpenGL allows you to set the red, green, and blue values for
each component of light
independently. Light sources have a number of properties, such
as color, position, and
direction. The following sections explain how to control these
properties and what the
resulting light looks like. There can be up to 8 source
points.
The command used to specify all properties of lights is
glLight*(); it takes three
arguments: to identify the light whose property is being
specified, the property, and the
desired value for that property.
void glLight{if}(GLenum light, GLenum pname, TYPEparam);
void glLight{if}v(GLenum light, GLenum pname, TYPE *param);
Table 5-1: Default Values for pname Parameter of glLight*()
Parameter Name Default Value Meaning
GL_AMBIENT (0.0, 0.0, 0.0,
1.0)
ambient RGBA intensity of light
GL_DIFFUSE (1.0, 1.0, 1.0,
1.0)
diffuse RGBA intensity of light
GL_SPECULAR (1.0, 1.0, 1.0,
1.0)
specular RGBA intensity of light
-
16
GL_POSITION (0.0, 0.0, 1.0,
0.0)
(x, y, z, w) position of light
GL_SPOT_DIRECTION (0.0, 0.0, -1.0) (x, y, z) direction of
spotlight
GL_SPOT_EXPONENT 0.0 spotlight exponent
GL_SPOT_CUTOFF 180.0 spotlight cutoff angle
3.2.2 Color
OpenGL allows you to associate three different color-related
parameters -
GL_AMBIENT, GL_DIFFUSE, and GL_SPECULAR - with any particular
light. The
GL_AMBIENT parameter refers to the RGBA intensity of the ambient
light that a
particular light source adds to the scene. As you can see in
Table 5-1, by default there is
no ambient light since GL_AMBIENT is (0.0, 0.0, 0.0, 1.0). If
this program had specified
blue ambient light as
GLfloat light_ambient[] = { 0.0, 0.0, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
3.2.3 Material Properties
This section describes how to define the material properties of
the objects in the scene:
the ambient, diffuse, and specular colors, the shininess, and
the color of any emitted light.
Most of the material properties are conceptually similar to ones
you've already used to
create light sources. The mechanism for setting them is similar,
except that the command
used is called glMaterial*().
void glMaterial{if}(GLenum face, GLenum pname, TYPEparam);
void glMaterial{if}v(GLenum face, GLenum pname, TYPE
*param);
Specifies a current material property for use in lighting
calculations. face can be
GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK to indicate which face
of the
-
17
object the material should be applied to. The particular
material property being set is
identified by pname and the desired values for that property are
given by param, which is
either a pointer to a group of values (if the vector version is
used) or the actual value (if
the nonvector version is used). The nonvector version works only
for setting
GL_SHININESS. The possible values for pname are shown in Table
5-3. Note that
GL_AMBIENT_AND_DIFFUSE allows you to set both the ambient and
diffuse material
colors simultaneously to the same RGBA value.
Table 5-3 : Default Values for pname Parameter of
glMaterial*()
Parameter Name Default Value Meaning
GL_AMBIENT (0.2, 0.2, 0.2,
1.0)
ambient color of material
GL_DIFFUSE (0.8, 0.8, 0.8,
1.0)
diffuse color of material
GL_AMBIENT_AND_DIFFUSE ambient and diffuse color of
material
GL_SPECULAR (0.0, 0.0, 0.0,
1.0)
specular color of material
GL_SHININESS 0.0 specular exponent
GL_EMISSION (0.0, 0.0, 0.0,
1.0)
emissive color of material
GL_COLOR_INDEXES (0,1,1) ambient, diffuse, and specular
color
indices
3.2.4 Diffuse and Ambient Reflection
The GL_DIFFUSE and GL_AMBIENT parameters set with glMaterial*()
affect the
color of the diffuse and ambient light reflected by an object.
Diffuse reflectance plays the
most important role in determining what you perceive the color
of an object to be. It's
affected by the color of the incident diffuse light and the
angle of the incident light
relative to the normal direction. (It's most intense where the
incident light falls
perpendicular to the surface.) The position of the viewpoint
doesn't affect diffuse
reflectance at all.
-
18
Ambient reflectance affects the overall color of the object.
Because diffuse reflectance is
brightest where an object is directly illuminated, ambient
reflectance is most noticeable
where an object receives no direct illumination. An object's
total ambient reflectance is
affected by the global ambient light and ambient light from
individual light sources. Like
diffuse reflectance, ambient reflectance isn't affected by the
position of the viewpoint.
For real-world objects, diffuse and ambient reflectance are
normally the same color. For
this reason, OpenGL provides you with a convenient way of
assigning the same value to
both simultaneously with glMaterial*():
GLfloat mat_amb_diff[] = { 0.1, 0.5, 0.8, 1.0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
mat_amb_diff);
3.2.5 Specular Reflection
Specular reflection from an object produces highlights. Unlike
ambient and diffuse
reflection, the amount of specular reflection seen by a viewer
does depend on the location
of the viewpoint - it's brightest along the direct angle of
reflection. To see this, imagine
looking at a metallic ball outdoors in the sunlight. As you move
your head, the highlight
created by the sunlight moves with you to some extent. However,
if you move your head
too much, you lose the highlight entirely.
OpenGL allows you to set the effect that the material has on
reflected light (with
GL_SPECULAR) and control the size and brightness of the
highlight (with
GL_SHININESS). You can assign a number in the range of [0.0,
128.0] to
GL_SHININESS - the higher the value, the smaller and brighter
(more focused) the
highlight. E.g.:
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat low_shininess[] = { 5.0 };
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess);
3.2.6 Emission
By specifying an RGBA color for GL_EMISSION, you can make an
object appear to be
giving off light of that color. Since most real-world objects
(except lights) don't emit
-
19
light, you'll probably use this feature mostly to simulate lamps
and other light sources in a
scene.
GLfloat mat_emission[] = {0.3, 0.2, 0.2, 0.0};
glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
-
20
4. Implementation
4.1 Algorithm
main()
{
Initialize Graphics mode
Initialize Window size
Create window
Myinit Func callback
Reshape Func callback
Display Func callback
Mouse Func callback
Keyboard Func callback
}
Display()
{
Call FrontScreen
Rotate light source according to input
Switch objects
MAIN_SCREEN
TORUS
TEAPOT
DOD
TET
ISO
Loop Back
}
-
21
4.2 Functions Used
4.2.1 glutMotionFunc, glutPassiveMotionFunc
glutMotionFunc and glutPassiveMotionFunc set the motion and
passive motion
callbacks respectively for the current window.
Usage
void glutMotionFunc(void (*func)(int x, int y));
void glutPassiveMotionFunc(void (*func)(int x, int y));
Description
glutMotionFunc and glutPassiveMotionFunc set the motion and
passive motion callback
respectively for the current window. The motion callback for a
window is called when the
mouse moves within the window while one or more mouse buttons
are pressed. The
passive motion callback for a window is called when the mouse
moves within the window
while no mouse buttons are pressed.
The x and y callback parameters indicate the mouse location in
window relative
coordinates.
Passing NULL to glutMotionFunc or glutPassiveMotionFunc disables
the generation of
the mouse or passive motion callback respectively.
-
22
4.2.2 gluPerspective
It set up a perspective projection matrix C Specification 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).
Description
gluPerspective specifies a viewing frustum into the world
coordinate system.
In general, the aspect ratio in gluPerspective should match the
aspect ratio
of the associated viewport. For example,
aspect = 2.0
means the viewer's angle of view is twice as wide in x as it is
in y.
If the viewport is twice as wide as it is tall, it displays the
image without distortion.
-
23
The matrix generated by gluPerspective is multipled by the
current matrix, just as if
glMultMatrix were called with the generated matrix. To load the
perspective matrix onto
the current matrix stack instead, precede the call to
gluPerspective with a call to
glLoadIdentity.
-
24
CHAPTER 7
RESULTS
7.1 Snapshots
-
25
-
26
-
27
-
28
-
29
6.CONCLUSION
It has been challenging and rewarding for us to do this
project