0% found this document useful (0 votes)
40 views40 pages

Chapter 2 - Rendering Process With OpenGL

Chapter 2 introduces the rendering process using OpenGL, defining OpenGL as a standard API for 2D and 3D graphics. It discusses the classifications of graphics software, coordinate systems, and the importance of transformations in rendering images. Additionally, it highlights OpenGL's features, libraries, and the role of output primitives in the graphics rendering pipeline.

Uploaded by

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

Chapter 2 - Rendering Process With OpenGL

Chapter 2 introduces the rendering process using OpenGL, defining OpenGL as a standard API for 2D and 3D graphics. It discusses the classifications of graphics software, coordinate systems, and the importance of transformations in rendering images. Additionally, it highlights OpenGL's features, libraries, and the role of output primitives in the graphics rendering pipeline.

Uploaded by

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

Daniel K

Computer science MSc


DanielKahsu317@gmail.
com

Chapter 2

Introduction to The Rendering Process with


OpenGL
Chapter Contents

 Define what is OpenGL


 Explain why OpenGL
 Features of OpenGL
 The Role of OpenGL in the Reference Model
 Coordinate Systems
 Viewing Using a Synthetic Camera
 Output Primitives and Attributes

2 Computer - Graphics -
2024
Graphics Software
 There are two broad classifications for computer-
graphics software

1. Special-purpose packages: Special-purpose


packages are designed for nonprogrammers
 Example: generate pictures, graphs, charts,
painting programs or CAD systems in some
application area without worrying about the
graphics procedure

3 Computer - Graphics -
2024
Cont’d

2. General programming packages: general programming


package provides a library of graphics functions that can
be used in a programming language such as C, C++, Java,
FORTRAN.
 Example: GL (Graphics Library), OpenGL, VRML (Virtual-
Reality Modeling Language), Java 2D And Java 3D

NOTE: A set of graphics functions is often called a


computer graphics application programming interface
(CG API)

4 Computer - Graphics -
2024
Coordinate Representations

 To generate a picture using a programming


package we first need to give the geometric
descriptions of the objects that are to be displayed
known as coordinates.
 If coordinate values for a picture are given in some
other reference frame (spherical, hyperbolic, etc.),
they must be converted to Cartesian coordinates.
 Several different Cartesian reference frames are
used in the process of constructing and displaying
5 Computer - Graphics -
2024
Cont’d

 First we define the shapes of individual objects, such


as trees or furniture, These reference frames are
called modeling coordinates or local coordinates Then
we place the objects into appropriate locations within
a scene reference frame called world coordinates.
 After all parts of a scene have been specified, it is
processed through various output device reference
frames for display. This process is called the viewing
pipeline.

6 Computer - Graphics -
2024
Cont’d
 The scene is then stored in normalized coordinates.
Which range from −1 to 1 or from 0 to 1 Normalized
coordinates are also referred to as normalized device
coordinates.
 The coordinate systems for display devices are
generally called device

NOTE: Geometric descriptions in modeling coordinates


and world coordinates can be given in coordinates, or
screen coordinates floating-point or integer values.

7 Computer - Graphics -
2024
Cont’d
 Example: Figure briefly illustrates the sequence of
coordinate transformations from modeling coordinates
to device coordinates for a display

8 Computer - Graphics -
2024
Graphics Functions

 It provides users with a variety of functions for


creating and manipulating pictures
 The basic building blocks for pictures are referred
to as graphics output primitives
 Attributes are properties of the output primitives
 We can change the size, position, or orientation
of an object using geometric transformations

9 Computer - Graphics -
2024
Cont’d

 Modeling transformations, which are used to


construct a scene.
 Viewing transformations are used to select a view
of the scene, the type of projection to be used and
the location where the view is to be displayed.
 Input functions are used to control and process the
data flow from these interactive devices(mouse,
tablet and joystick)

10 Computer - Graphics -
2024
Introduction to OpenGL

 OpenGL (Open Graphics Library) is the computer


industry's standard application program interface
( API ) for defining 2-D and 3-D graphic images.
 Most widely adopted graphics API
 Easy to use, well documented
 Cross platform and cross language
 Everything is primitive (can accept only simple
shapes and sizes)
11 Computer - Graphics -
2024
Cont’d

12 Computer - Graphics -
2024
Why OpenGL?
 Device independence
 Platform independence
 SGI Irix, MAC, Linux, Windows
 Abstractions (GL, GLU, GLUT)
 Open source: Hardware-independent software
interface
 Support of client-server protocol Other APIs

13 Computer - Graphics -
2024
Features of OpenGL
 3D Transformations
 Rotations, scaling, translation, perspective
 Color models
 Values: R, G, B, alpha.
 Lightning
 Flat shading, Gouraud shading, Phong shading
 Rendering
 Texture mapping
 Modeling
 non-uniform rational B-spline (NURB) curves,
surfaces
14 Computer - Graphics -
2024
What is RENDERING
 Rendering - is the process by which a computer creates
images from models. These models, or objects, are
constructed from geometric primitives – points (pixels),
lines, and polygons - that are specified by their vertices.
 The final rendered image consists of pixels drawn on the
screen; a pixel is the smallest visible element the display
hardware can put on the screen.
 Information about the pixels (for instance, what color
they're supposed to be) is organized in memory into
bitplanes.
15 Computer - Graphics -
2024
Cont’d
 A bitplane is an area of memory that holds one bit
of information for every pixel on the screen; the bit
might indicate, for example how red a particular
pixel is supposed to be.
 The bitplanes are themselves organized into a
framebuffer, which holds all the information that the
graphics display needs to control the color and
intensity of all the pixels on the screen

16 Computer - Graphics -
2024
OpenGl Libraries
 Several libraries are built on top of or beside OpenGL to
provide features not available in OpenGL itself. They
include:
 The OpenGL Utility Library (GLU)
 The OpenGL Utility Toolkit (GLUT)
 Simple DirectMedia Layer (SDL)
 OpenGL User Interface Library (GLUI)
 OpenGL Extension Wrangler Library (GLEW)
 OpenGL Easy Extension library (GLEE)
 Fast, Light Toolkit" (FLTK)
17 Computer - Graphics -
2024
Preliminaries

18 Computer - Graphics -
2024
Cont’d

19 Computer - Graphics -
2024
Cont’d

20 Computer - Graphics -
2024
Example

21 Computer - Graphics -
2024
Cont’d

22 Computer - Graphics -
2024
OpenGl Utilities Toolkit ( GLUT )

23 Computer - Graphics -
2024
Cont’d
 OpenGL: the core library, it is platform (i.e. hardware
system) independent,
 glut:
 The GL Utilities Toolkit, it contains some extra
routines for drawing 3-D objects and other
primitives. Using glut with OpenGL enables us to
write windows-system independent code.
 glu:
 The OpenGL Utilities, it contains some extra routines
for projections and rendering complex 3-D objects.
 glui: Contains some extra routines for creating user-
interfaces.
24 Computer - Graphics -
2024
Coordinate Systems
 In graphics program, we may need to deal with a number
of different coordinate systems, and a good part of the
work ( and the cause of many headaches ) is the
conversion of coordinates from one system to another. list
of some of the coordinate systems you may encounter:
 World Coordinate System
 Screen Coordinate System
 Object Coordinate System
 Viewport Coordinate
 Viewpoint Coordinate System
System
 Model Window Coordinate System

25 Computer - Graphics -
2024
Cont’d

World Coordinate System –

 Also known as the "universe" or sometimes "model"

coordinate system.

 This is the base reference system for the overall

model, ( generally in 3D ), to which all other model

coordinates relate.

26 Computer - Graphics -
2024
Cont’d

 Object Coordinate System - When each object is created


in a modelling program, the modeler must pick some
point to be the origin of that particular object, and the
orientation of the object to a set of model axes.
 For example when modelling a desk, the modeler might
choose a point in the center of the desk top for the
origin, or the point in the center of the desk at floor
level, or the bottom of one of the legs of the desk.

27 Computer - Graphics -
2024
Cont’d

 When this object is moved to a point in the world


coordinate system, it is really the origin of the
object ( in object coordinate system ) that is moved
to the new world coordinates, and all other points
in the model are moved by an equal amount. Note
that while the origin of the object model is usually
somewhere on the model itself, it does not have to
be

28 Computer - Graphics -
2024
Cont’d

 Viewpoint Coordinate System- Also known as the


"camera" coordinate system.
 This coordinate system is based upon the viewpoint
of the observer, and changes as they change their
view.
 Moving an object "forward" in this coordinate
system moves it along the direction that the viewer
happens to be looking at the time.

29 Computer - Graphics -
2024
Cont’d

 Model Window Coordinate System :- Not to be


confused with desktop windowing systems ( MS
Windows or X Windows ), this coordinate system
refers to the subset of the overall model world that is
to be displayed on the screen.
 Depending on the viewing parameters selected, the
model window may be rectalinear or a distorted
viewing frustrum of some kind.

30 Computer - Graphics -
2024
Cont’d
 Screen Coordinate System :- This 2D coordinate system
refers to the physical coordinates of the pixels on the
computer screen, based on current screen resolution. ( E.g.
1024x768 )
 Viewport Coordinate System - This coordinate system
refers to a subset of the screen space where the model
window is to be displayed.
 Typically the viewport will occupy the entire screen window,
or even the entire screen, but it is also possible to set up
multiple smaller viewports within a single screen window.

31 Computer - Graphics -
2024
32 Computer - Graphics -
2024
Cont’d

33 Computer - Graphics -
2024
Viewing Using a Synthetic Camera

 Synthetic camera A type of rendering technique that

seeks to replicate the characteristics of a real camera

or the human eye, rather than the perfectly sharp

neutral pictures usually produced by computer

graphics.

 Graphics generated images may not be visible to

camera or human eye (may have hidden parts)

34 Computer - Graphics -
2024
Other Description

 Imagine you are taking a picture with your camera


 Objects in the room may be best described in a local
coordinate system unique to each object
 They also have position and orientation in the world
 Your camera also has a position and orientation,
which determines where it is looking.
 our camera has settings, such as size, field of view,
and resolution, which help define how the final
picture is rendered
35 Computer - Graphics -
2024
Cont’d
 The synthetic camera model used in computer graphics
mimics this process, using transformations between
different coordinate systems to render an image.
 These transformations are implemented using matrices.

36 Computer - Graphics -
2024
Output Primitives and Attributes

 The inputs to the Graphics Rendering Pipeline are

geometric primitives such as :

 Triangle, Point, Line and Quad which is formed by

one or more vertices.

 OpenGL supports three classes of geometric primitives:

 points, line segments, and closed polygons.

 They are specified via vertices.


37 Computer - Graphics -
2024
Cont’d

 Each vertex is associated with its attributes such as the

position, color, normal and texture.

 OpenGL provides 10 primitives as shown in the next Slide.

 Sphere, 3D box and pyramid are not primitives.

 They are typically assembled using primitive triangle or

quad.

38 Computer - Graphics -
2024
Cont’d

39 Computer - Graphics -
2024
End of chapter one

40 Computer - Graphics -
2024

You might also like