Chapter 1 Overview of Computer Graphics Zhang Liang

  • Slides: 17
Download presentation
Chapter 1 Overview of Computer Graphics Zhang & Liang, Computer Graphics Using Java 2

Chapter 1 Overview of Computer Graphics Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 1

Objectives To understand the basic objectives and scope of computer graphics F To identify

Objectives To understand the basic objectives and scope of computer graphics F To identify computer graphics applications F To understand the basic structures of 2 D and 3 D graphics systems F To understand evolution of graphics programming environments F To identify common graphics APIs F To understand the roles of Java language, Java 2 D and Java 3 D packages F To identify computer graphics related fields F Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 2

Computer Graphics Modeling: Creating a virtual world. Rendering: Generating a visual image of a

Computer Graphics Modeling: Creating a virtual world. Rendering: Generating a visual image of a scene. Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 3

Graphics System: Components and Functions Modeler F Renderer F Hardware device F Virtual World

Graphics System: Components and Functions Modeler F Renderer F Hardware device F Virtual World F View F Geometry F Transformation F Illumination F Interaction F Animation F Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 4

Applications F User interface F Computer Aided Design F Medical systems F Video games

Applications F User interface F Computer Aided Design F Medical systems F Video games F Movies F… Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 5

Graphics Programming Environment Platform Independent (Java 3 D) Graphics Standard (GKS, PHIGS, Open. GL)

Graphics Programming Environment Platform Independent (Java 3 D) Graphics Standard (GKS, PHIGS, Open. GL) OS (WIN 32, X, Mac OS) Hardware (direct register/video buffer programming) Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 6

Hardware Level F F F Program the graphics hardware directly Typically written in low-level

Hardware Level F F F 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 Determination of the pixels on a circle. From the current pixel, the next pixel will be either to the “east” or to the “southeast”. Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 7

Operating System Level F F Program through OS graphics support Do not directly manipulate

Operating System Level F F Program through OS graphics support Do not directly manipulate graphics hardware Portable on the same platform Example: WIN 32 hdc = Begin. Paint (hwnd, &ps); Get. Client. Rect (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); End. Paint (hwnd, &ps); Source Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 8

GKS and PHIGS Graphics Kernel System F F International standard (ISO 7942 1985) 2

GKS and PHIGS Graphics Kernel System F F International standard (ISO 7942 1985) 2 D graphics Common language binding: FORTRAN Example: A FORTRAN GKS program to draw a circle Source Programmer’s Hierarchical Interactive Graphics System F F ISO 9592 1991 3 D graphics Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 9

Open. GL F F Popular 2 D/3 D graphics API over 200 functions Common

Open. GL F F Popular 2 D/3 D graphics API over 200 functions Common language binding: C Example: An Open. GL program to draw a circle Source Run GLUT GLU GL Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 10

Open. GL 3 D Example: A spinning sphere Source Run Zhang & Liang, Computer

Open. GL 3 D Example: A spinning sphere Source Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 11

Java 3 D based graphics systems Graphics application Java APIs Java 3 D Java

Java 3 D based graphics systems Graphics application Java APIs Java 3 D Java VM Open. GL OS Display driver Graphics card Display Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 12

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

Java Programming Languages F Simple F Object Oriented (OOP) F Write once, run anywhere F Multithreaded Java graphics: AWT / Swing Source AWT Example Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 13

JOGL F Open. GL Java language binding F No OOP modeler 1. Create a

JOGL F Open. GL Java language binding F No OOP modeler 1. Create a GLCanvas or GLJPanel object through the GLDrawable. Factory class. 2. Add a GLEvent listener to the canvas object. 3. Implement the listener by implementing the four methods: init, display, reshape, and display. Changed. Source Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 14

Java 2 D F Standard package of Java 2 platform F Improvements over AWT

Java 2 D F Standard package of Java 2 platform F Improvements over AWT F Graphics 2 D class Source Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 15

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

Java 3 D High-level API F Scene graph F Modeler/Renderer F Java Integration F Source Run Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 16

Other Fields Related to Graphics F F F Image processing Computer vision Mathematics –

Other Fields Related to Graphics F F F Image processing Computer vision Mathematics – Analytic geometry – Linear algebra Zhang & Liang, Computer Graphics Using Java 2 D and 3 D (c) 2007 Pearson Education, Inc. All rights reserved. 17