0% found this document useful (0 votes)
17 views

Week01 (Introduction Primitives)

Uploaded by

cheery.bowl7899
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Week01 (Introduction Primitives)

Uploaded by

cheery.bowl7899
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Chapter 1, Introduction to

computer graphics and


multimedia

1
Objectives
• To understand the basic objectives and scope of
computer graphics
• To identify computer graphics applications
• To understand the basic structures of 2D and 3D
graphics systems
• To understand evolution of graphics programming
environments
• To identify common graphics APIs
• To understand the roles of Java language, Java 2D and
Java 3D packages
• To identify computer graphics related fields 2
Computer graphics
• Computer graphics provides methods to generate
images using a computer.
• An image can represent a realistic scene from the
real world, but graphics like histograms or pie
charts as well as the graphical user interface of a
software tool are also considered as images.

3
Computer graphics- Application fields
• Graphical user interfaces
• Visualising high-dimensional data
• Generation of realistic images and sequences of images
• Designing, modelling and visualising objects
• The combination of real data and images with techniques from computer
graphics will probably gain more importance than it has today.
• Computer
games
• Advertising
• Virtual reality

4
From areal scene to an image

5
From areal scene to an image
• a. The objects in the scene have to be modelled with
the techniques and methods provided by a computer
graphics tool.
• b. Approximation by assuming that the computer
graphics tool is very restricted and the bowl in the
real scene can only be approximated by a semisphere.
• c. Projection from 2D to 3D
• d. Clipping, The whole process of generating a pixel
image from a three-dimensional
virtual scene is called rendering.
6
Computer Graphics
Main tasks of computer graphics: modeling a virtual
world and rendering a scene
Modeling: Creating a virtual world.
Rendering: Generating a visual image of a scene.

Rendering

7
Image of a scene
Virtual world model
Modeling- polygon shapes

8
Modeling- polygon shapes
Many shapes can be stored as
a list of polygons in terms of
vertex list.

9
Modeling- polygon shapes
failure

10
Modeling- polygon shapes
level of detail

11
Modeling- polygon shapes
level of details

12
Graphics System:
Components and Functions
• Modeler • Geometry
• Renderer • Transformation
• Hardware device • Illumination
• Virtual World • Interaction
• View • Animation

13
Computer Graphics
- Graphics objects to be modeled are in either a 2D or a
3D space.
- This common space to host all the graphic objects is
often called the world space
- The graphics objects to be modeled in a world space
are usually geometric entities such as lines and
surfaces, but they also include other special objects
such as lights, texts and images
- The graphics objects may possess many characteristics
14
and properties such as color, transparency and texture
Graphics System:
Components and Functions
• Modeler is responsible for the construction of
virtual world models
• Renderer perform the rendering of the scene
• Object transformations are geometric
transformations applied to the objects to achieve
the proper placement of the objects in the virtual
space
• GUI is based on the user interactions with graphic
systems.
15
Computer Graphics: Geometric
transformations

• Object transformation is the mapping of the object


spaces into world space that is common coordinate
reference system for all objects.
• Viewing transformation is the transformation from
the world space to device space
• A useful family of the geometric transforms is the
affine transforms which include the most common
types such as a translation, rotations, scaling and
reflections 16
Computer Graphics: view
• A view is used to see the model in the virtual world from a specific
perspective
• 2D view
- Relatively simple
- Viewing transformation is indistinguishable from the object
transformation
- Rendering features such as composition rules and clipping path
may be applied
• 3D view
- More complicated
- Like eyes or cameras
- Involves a projection process that maps 3d objects to a 2D plane
- Projection, view position, orientation, and field of view could
17
affect the 3D rendering
Computer Graphics: Hardware
devices
• The capabilities and characteristics of hardware
devices have a great impact on graphics systems
• Output devices for displaying the results of the
graphics rendering like
• Video monitors
• Printers
• Plotters
• Input devices
• Mice
• Joysticks
• Tablets with pens 18
Computer Graphics: Animation and
Interaction
• Animation
• Animation is an important part in computer graphics
• Instead of still images, animation produces dynamic graphics
contents and rendering
• Animations plays an important rule in applications such as a
movie-scene rendering and gaming
• Interaction
• In response to user inputs, the graphics model may change
accordingly
• The fundamental principle of GUI is based on the user
interactions with graphics systems
• Another example of extensive application of interaction is 19
video games
Graphics Programming Environment

• Graphics programming has appeared in almost every


level of computer architecture
• It is moving from low-level, platform-dependent
methods toward abstract, high level, and portable
environments

Platform Independent (Java 3D)


Graphics Standard (GKS, PHIGS, OpenGL)
OS (WIN32, X, Mac OS)
Hardware (direct register/video buffer programming)
20
Hardware Level
Program the graphics hardware directly
Typically written in low-level languages
Written in assembly language and manipulate the hardware
registers and video buffers
Highly machine-dependent
Example: MS-DOS graphics program

Determination of the pixels on a circle.


From the current pixel, the next pixel will E
SE

be either to the “east” or to the


“southeast”.

21
Operating System Level
Program through OS graphics support
Do not directly manipulate graphics hardware
Portable on the same platform
Graphics APIs (application programming interfaces)
provided at the operating system level offer a uniform
interface for graphics programming within the same
platform
Example: WIN32 is the API for 32 bit windows operating
systems

22
Operating System Level
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rc);
cx = (rc.left + rc.right)/2;
cy = (rc.top + rc.bottom)/2;
if (rc.bottom - rc.top < rc.right - rc.left)
r = (rc.bottom - rc.top) / 2 - 20;
else
r = (rc.right - rc.left) / 2 - 20;
Ellipse(hdc, cx-r, cy-r, cx+r, cy+r);
EndPaint (hwnd, &ps);

Problem: Graphics programs that rely on operating system are not portable across
different platforms
➢ example: In Windows and Mac OS, APIs are different

23
GKS and PHIGS
Graphics programming will provide a layer of abstraction necessary for device and
platform independence
Graphics Kernel System GKS

International standard (ISO 7942 1985)


Independent in device platform
2D graphics
Common language binding: FORTRAN
Example: A FORTRAN GKS program to draw a circle

Programmer’s Hierarchical Interactive Graphics System PHIGS

ISO 9592 1991


3D graphics
24
OpenGL
Popular 2D/3D graphics API derived from GL (Graphics
Library)
over 200 functions
Provides more powerful graphics API than the earlier
standards such as GKS
Common language binding: C
OpenGL consists of Two libraries:
GL Library contains the core functions for basics
GLUT graphics features
GLU
GLU (open GL Utility Library) contains higher level
utility functions
GL
GLUT( OpenGL Utility Toolkit) used with open GL to
construct a complete graphic program 25
Java
➢ Open GL provides a standard and efficient rendering
interface to graphics hardware
➢ However, with the rapid development of computer
hardware and software
➢ A high level OOP-based graphics offer great benefits
➢ Java 2D and java 3D are newer graphics APIs with high
portability
➢ Java 3D based graphics systems implemented on the top of
other APIs such as OpenGL

26
Java
An overview of the Java language and it graphics facilities

Graphics application
Java APIs Java 3D
Java VM OpenGL
OS
Display driver
Graphics card
Display

27
Java Programming Languages
• Simple
• Object Oriented (OOP)
• Write once, run anywhere
• Multithreaded
• Java contains two nearly parallel sets of facilities for GUI programing
• AWT(Abstract Window Toolkit) offers capabilities to control certain rendering
attributes such as drawing color and to draw some graphics primitives such as
lines, rectangles and ovals. However, these features are limited.
• Swing is a completely redesigned GUI programming API included in the Java 2
platform

28
JOGL
• One graphics programming for Java is OpenGL
• OpenGL Java language binding
• The two componenets GLCanvas and GLJpanel provide the
drawing surfaces for the openGL calls
• A typical procedure for programming JOGL is outlined below
1. Create a GLCanvas or GLJPanel object through the
GLDrawableFactory class.
2. Add a GLEvent listener to the canvas object.
3. Implement the listener by implementing the four methods: init,
display, reshape, and displayChanged.

29
Minimum Java graphics app.
package javaapplication1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.geom.*;
import java.util.Random;
import javax.imageio.*;
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
30
public class JavaApplication1 extends JApplet{
public static void main(String[] args) {
// TODO code application logic here
JFrame frame=new JFrame();
frame.setTitle("hello");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applete =new JavaApplication1();
applete.init();
frame.getContentPane().add(applete);
frame.pack();
frame.setVisible(true);
}
public void init(){
JPanel panel=new JApp1Panel();
getContentPane().add(panel);
}}

31
class JApp1Panel extends JPanel{
public JApp1Panel(){
setPreferredSize(new Dimension(640,480));
}
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2=(Graphics2D) g;
SimpleClip(g2);
}

32
Java 2D
• Standard package of Java 2 platform
• Improvements over AWT
• Graphics2D class
• Java 2D provides a rather complete set of functionalities to
manipulate and render 2D graphics
• The enhancements include
• A separate class hierarchy for geometric objects is defined
in Java 2D
• The rendering process much more refined
• Completely new image processing features are introduced
• Color models, fonts, printing, and other related supports
are also greatly improved
33
• The Graphics2D class, a subclass of the Graphics class, is the
rendering for java 2D
Java 3D
• 3D graphics includes advanced features as animation, 3d
interactions and sophisticated viewing
•High-level API
• Scene graph contains the complete information of the virtual
graphics world
•The visual effects of the program are achieved by creating a
scene graph and placing the appropriate graphics elements into
it
•The scene graph for the program is a treelike structure
containing objects such as the sphere, the 3D text, appearance,
transforms, background, lights, and so on
•The rendering of the scene is done automatically by the java 3D
engine 34
• Modeler/Renderer
• Java Integration
Other Fields Related to Graphics
• Image processing
• Computer vision
• Mathematics
• Analytic geometry
• Linear algebra

35

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy