CS 297 Graphics with Java and Open GL

  • Slides: 24
Download presentation
CS 297 Graphics with Java and Open. GL Introduction Uni. S

CS 297 Graphics with Java and Open. GL Introduction Uni. S

 • The Open. GL graphics system is a software interface to graphics hardware.

• The Open. GL graphics system is a software interface to graphics hardware. (The GL stands for Graphics Library. ) • For interactive programs that produce color images of moving three-dimensional objects. • First introduced 1992. Uni. S 2

Open. GL With Open. GL, you can control computer-graphics technology to produce realistic pictures

Open. GL With Open. GL, you can control computer-graphics technology to produce realistic pictures or ones that depart from reality in imaginative ways. Open. GL has become the industry standard for graphics applications and games. Uni. S 3

JOGL Open. GL is originally written in C. JOGL is the Java Open. GL

JOGL Open. GL is originally written in C. JOGL is the Java Open. GL programming bindings to Open. GL APIs. JOGL, since 2003, is maintained and supported by Sun Microsystems as one of their official Java projects: https: //jogl. dev. java. net/ Uni. S 4

Texts • Free online copy of the original Open. GL V 1. 1 Redbook:

Texts • Free online copy of the original Open. GL V 1. 1 Redbook: http: //www. gamedev. net/reference/count. asp ? Link. ID=993 • Note: written in C, not Java. However this is a very informative book, which has been used extensively for this course as the main source of examples and core material. • Goes in-depth into many aspects of computer graphics that are invaluable as aid to understanding subject. • All examples from Redbook have been translated into Java and are available online: http: //ak. kiet. le. googlepages. com/theredbookinjava. html Uni. S 5

Texts • Learning Java Bindings for Open. GL (JOGL) is cheap (less than £

Texts • Learning Java Bindings for Open. GL (JOGL) is cheap (less than £ 12 on Amazon) and has basics. Not as in-depth or comprehensive as the free Redbook. Not compatible with current version of JOGL, beware! Uni. S 6

Course Details • Course follows same basic outline as Open GL Redbook, except we

Course Details • Course follows same basic outline as Open GL Redbook, except we use JOGL not C. Core material split into following sections • "Introduction to Open. GL, " provides a glimpse into the kinds of things Open. GL can do. Includes simple Open. GL program and essential programming details you need to know for subsequent sections. Uni. S 7

Course Details • "State Management and Drawing Geometric Objects, " how to create a

Course Details • "State Management and Drawing Geometric Objects, " how to create a three-dimensional geometric description of an object that is eventually drawn on the screen. • "Viewing, " how three-dimensional models are transformed before being drawn onto a twodimensional screen. You can control these transformations to show a particular view of a model. • "Color, " how to specify the colour and shading method used to draw an object. • "Lighting, " how to control the lighting conditions surrounding an object and how that object responds to light (that is, how it reflects or absorbs light). Lighting is an important topic, since objects usually don't look three-dimensional until they're lit. Uni. S 8

Introduction to Open. GL • "What Is Open. GL? ", what it does and

Introduction to Open. GL • "What Is Open. GL? ", what it does and doesn't do, and how it works. • "A Smidgen of Open. GL Code" presents a small Open. GL program and briefly discusses it. • "Open. GL Command Syntax" explains some of the conventions and notations used by Open. GL commands. • "Open. GL as a State Machine" describes the use of state variables in Open. GL and the commands for querying, enabling, and disabling states. • "Open. GL Rendering Pipeline" shows a typical sequence of operations for processing geometric and image data. • "Animation" explains in high level terms how to create pictures on the screen that move. Uni. S 9

Introduction to Open. GL Uni. S • Open. GL is a software interface to

Introduction to Open. GL Uni. S • Open. GL is a software interface to graphics hardware. • This interface consists of about 200 distinct commands that you use to specify the objects and operations needed to produce interactive three-dimensional applications. 10

Introduction to Open. GL Uni. S • Open. GL is designed as a streamlined,

Introduction to Open. GL Uni. S • Open. GL is designed as a streamlined, hardware-independent interface to be implemented on many different hardware platforms. • No commands for performing windowing tasks or obtaining user input are included in Open. GL; • Similarly, Open. GL doesn't provide high-level commands for describing models of three-dimensional objects. • With Open. GL, you must build up your desired model from a small set of geometric primitives - points, lines, and polygons. 11

Introduction to Open. GL, Basic Image Construction • Lets look at how the cover

Introduction to Open. GL, Basic Image Construction • Lets look at how the cover plate for the Redbook is constructed with Open. Gl Uni. S 12

Introduction to Open. GL, Basic Image Construction • Cover scene constructed as a wireframe

Introduction to Open. GL, Basic Image Construction • Cover scene constructed as a wireframe model Uni. S 13

Introduction to Open. GL, Basic Image Construction • Each line of wire corresponds to

Introduction to Open. GL, Basic Image Construction • Each line of wire corresponds to an edge of a primitive (typically a polygon). • For example, the surface of the table is constructed from triangular polygons that fit together in a sort of 3 d jigsaw Uni. S 14

Introduction to Open. GL, Basic Image Construction • Note that you can see portions

Introduction to Open. GL, Basic Image Construction • Note that you can see portions of objects that would be obscured if the objects were solid rather than wireframe. • For example, you can see the entire model of the hills outside the window even though most of this model is normally hidden by the wall of the room. • The globe appears to be nearly solid because it's composed of hundreds of colored blocks, and you see the wireframe lines for all the edges of all the blocks, even those forming the back side of the globe. Uni. S 15

Introduction to Open. GL, Basic Image Construction • Depth-cued version of wireframe scene. Note

Introduction to Open. GL, Basic Image Construction • Depth-cued version of wireframe scene. Note that the lines farther from the eye are dimmer, giving a visual cue of depth. Uni. S 16

Introduction to Open. GL, Basic Image Construction • Open. GL uses atmospheric effects (collectively

Introduction to Open. GL, Basic Image Construction • Open. GL uses atmospheric effects (collectively referred to as fog) to achieve depth cueing. Uni. S 17

Introduction to Open. GL, Basic Image Construction Antialiased version of the wireframe scene. Uni.

Introduction to Open. GL, Basic Image Construction Antialiased version of the wireframe scene. Uni. S 18

Introduction to Open. GL, Basic Image Construction • Antialiasing is a technique for reducing

Introduction to Open. GL, Basic Image Construction • Antialiasing is a technique for reducing the jagged edges (also known as jaggies) created when approximating smooth edges using pixels - short for picture elements - which are confined to a rectangular grid. • Such jaggies are usually the most visible with nearhorizontal or near-vertical lines. Uni. S 19

Introduction to Open. GL, Basic Image Construction • Flat-shaded, unlit version of the scene.

Introduction to Open. GL, Basic Image Construction • Flat-shaded, unlit version of the scene. Uni. S 20

Introduction to Open. GL, Basic Image Construction • The objects in the scene are

Introduction to Open. GL, Basic Image Construction • The objects in the scene are now shown as solid. • They appear "flat" in the sense that only one color is used to render each polygon, so they don't appear smoothly rounded. • There are no effects from any light sources. Uni. S 21

Introduction to Open. GL, Basic Image Construction • Lit, smooth-shaded version of the scene.

Introduction to Open. GL, Basic Image Construction • Lit, smooth-shaded version of the scene. Uni. S 22

Introduction to Open. GL, Basic Image Construction • scene looks much more realistic and

Introduction to Open. GL, Basic Image Construction • scene looks much more realistic and threedimensional • objects are shaded to respond to the light sources in the room as if the objects were smoothly rounded. Uni. S 23

Introduction to Open. GL, Basic Image Construction • Final Image again, built from previous

Introduction to Open. GL, Basic Image Construction • Final Image again, built from previous images, also has texture mapping and shadows. • Texture mapping allows you to apply a twodimensional image onto a three-dimensional object. • Table surface is the most vibrant example of texture mapping. • The wood grain on the floor and table surface are all texture mapped, as well as the wallpaper and the toy spinning top. Uni. S 24