20
Overview of Computer Graphics Chapter 1

Overview of Computer Graphics Chapter 1. Bird’s Eye View Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

Embed Size (px)

Citation preview

Page 1: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

Overview of Computer Graphics

Chapter 1

Page 2: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

2

Bird’s Eye View Overview of Computer Graphics

– Basic concept of computer graphics, system, programming platforms, and standard

2D Graphics: Basics 2D Graphics: Rendering Details 2D Graphics: Advanced topics

Page 3: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

3

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

Page 4: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

4

Computer Graphics

Modeling: Creating a virtual world.

Rendering: Generating a visual image of a scene.

Rendering

Virtual world model Image of a scene

Page 5: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

5

Graphics System: Components and Functions

ModelerRendererHardware deviceVirtual WorldView

GeometryTransformationIlluminationInteractionAnimation

Page 6: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

6

Applications

User interface Computer Aided Design Medical systems Video games Movies …

Page 7: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

7

Graphics Programming Environment

Hardware (direct register/video buffer programming)

OS (WIN32, X, Mac OS)

Graphics Standard (GKS, PHIGS, OpenGL)

Platform Independent (Java 3D)

Page 8: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

8

Hardware Level

E

SE

Determination of the pixels on a circle. From the current pixel, the next pixel will be either to the “east” or to the “southeast”.

Program the graphics hardware directly Typically written in low-level languages Manipulate the hardware registers and video buffers Highly machine-dependent Example: MS-DOS graphics program

Source

Page 9: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

9

Operating System Level Program through OS graphics support Do not directly manipulate graphics hardware Portable on the same platform Example: WIN32

Source Run

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);

Page 10: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

10

GKS and PHIGSGraphics Kernel System

Programmer’s Hierarchical Interactive Graphics System

International standard (ISO 7942 1985) 2D graphics Common language binding: FORTRAN Example: A FORTRAN GKS program to draw a circle

ISO 9592 1991 3D graphics

Source

Page 11: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

11

OpenGL

Source

Popular 2D/3D graphics API over 200 functions Common language binding: C Example: An OpenGL program to draw a circle

GLU

GLUT

GLRun

Page 12: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

12

OpenGL

Source

3D Example: A spinning sphere

Run

Page 13: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

13

Java

Java 3D

OpenGL

Java APIs

Display driver

Graphics card

Display

Graphics application

Java VM

OS

Java 3D based graphics systems

Page 14: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

14

Java Programming Languages Simple Object Oriented (OOP) Write once, run anywhere Multithreaded

Java graphics: AWT / SwingSource

Page 15: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

15

JOGL OpenGL Java language binding No OOP modeler

Source

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.

Page 16: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

Steps Required to Set Up GUI Event Handling

Several coding steps are required for an application to respond to events– Create a class for the event handler– Implement an appropriate event-listener interface– Register the event handler

16

Page 17: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

Events and Listeners

17

Component

A component objectmay generate an event

Listener

A corresponding listenerobject is designed torespond to the event

Event

When the event occurs, the component callsthe appropriate method of the listener,

passing an object that describes the event

Page 18: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

18

Java 2D

Standard package of Java 2 platform Improvements over AWT Graphics2D class

Source

Page 19: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

19

Java 3D High-level API Scene graph Modeler/Renderer Java Integration

Source

TG

Rotator

Appearance

Texture2D

Background

Bounds Sphere

Geometry

Texture coordinates

TG

Appearance Text3D

L

BG

L

S

Material

View

Branch

Page 20: Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,

20

Other Fields Related to Graphics Image processing Computer vision Mathematics

– Analytic geometry– Linear algebra