introduction to computer graphics cs 445 / 645 lecture 3 general graphics systems lecture 3 general...

35
Introduction to Computer Graphics CS 445 / 645 Lecture 3 Lecture 3 General Graphics Systems General Graphics Systems Daniel Rozin, Wooden Mirror (1999)

Upload: colin-evans

Post on 22-Dec-2015

225 views

Category:

Documents


4 download

TRANSCRIPT

Introduction to Computer GraphicsCS 445 / 645

Lecture 3Lecture 3

General Graphics SystemsGeneral Graphics Systems

Lecture 3Lecture 3

General Graphics SystemsGeneral Graphics Systems

Daniel Rozin, Wooden Mirror (1999)

AnnouncementAnnouncement• Assignment 1 (Fire Truck) is outAssignment 1 (Fire Truck) is out

– Due Feb 3Due Feb 3rdrd

Overview – Read Chapter 2 and Appendix A1-A5Overview – Read Chapter 2 and Appendix A1-A5• Display devicesDisplay devices

• Graphics hardwareGraphics hardware

• Input devicesInput devices

• Graphics SoftwareGraphics Software

AnnouncementAnnouncement• Assignment 1 (Fire Truck) is outAssignment 1 (Fire Truck) is out

– Due Feb 3Due Feb 3rdrd

Overview – Read Chapter 2 and Appendix A1-A5Overview – Read Chapter 2 and Appendix A1-A5• Display devicesDisplay devices

• Graphics hardwareGraphics hardware

• Input devicesInput devices

• Graphics SoftwareGraphics Software

Review

• CRTsCRTs

– Vector basedVector based

– Raster basedRaster based

– InterlacingInterlacing

• CRTsCRTs

– Vector basedVector based

– Raster basedRaster based

– InterlacingInterlacing

Review

Vector vs. RasterVector vs. Raster

• Another place we see this… web-based graphicsAnother place we see this… web-based graphics

– Macromedia flash is vector basedMacromedia flash is vector based

– JPG images are raster basedJPG images are raster based

Vector vs. RasterVector vs. Raster

• Another place we see this… web-based graphicsAnother place we see this… web-based graphics

– Macromedia flash is vector basedMacromedia flash is vector based

– JPG images are raster basedJPG images are raster basedSo what…

• Time to transmit vs. time to generateTime to transmit vs. time to generate

– Bandwidth vs. CPUBandwidth vs. CPU

• Reuse of image descriptionReuse of image description

• Time to transmit vs. time to generateTime to transmit vs. time to generate

– Bandwidth vs. CPUBandwidth vs. CPU

• Reuse of image descriptionReuse of image description

Vector Graphics

How to generate an image using vectorsHow to generate an image using vectors• A line is represented by endpoints (10,10) to (90,90)A line is represented by endpoints (10,10) to (90,90)

• The points along the line are computed using a line equationThe points along the line are computed using a line equation

– y = mx + by = mx + b

• If you want the image larger, no If you want the image larger, no problem…problem…

How to generate an image using vectorsHow to generate an image using vectors• A line is represented by endpoints (10,10) to (90,90)A line is represented by endpoints (10,10) to (90,90)

• The points along the line are computed using a line equationThe points along the line are computed using a line equation

– y = mx + by = mx + b

• If you want the image larger, no If you want the image larger, no problem…problem…

Cheap transmission

Computation required

Raster Graphics

How to generate a line using rastersHow to generate a line using rasters

• A line is represented by assigning some pixels a value of 1A line is represented by assigning some pixels a value of 1

• The entire line is specified by the pixel valuesThe entire line is specified by the pixel values

– What do we do to make image larger?What do we do to make image larger?

How to generate a line using rastersHow to generate a line using rasters

• A line is represented by assigning some pixels a value of 1A line is represented by assigning some pixels a value of 1

• The entire line is specified by the pixel valuesThe entire line is specified by the pixel values

– What do we do to make image larger?What do we do to make image larger?

No computation

Lot’s of extra info to communicate

Display Technology: LCDs

Liquid Crystal Displays (LCDs)Liquid Crystal Displays (LCDs)

• LCDs: organic molecules, naturally in crystalline LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or E fieldstate, that liquefy when excited by heat or E field

• Crystalline state twists polarized light 90º. Crystalline state twists polarized light 90º.

Liquid Crystal Displays (LCDs)Liquid Crystal Displays (LCDs)

• LCDs: organic molecules, naturally in crystalline LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or E fieldstate, that liquefy when excited by heat or E field

• Crystalline state twists polarized light 90º. Crystalline state twists polarized light 90º.

Display Technology: LCDs

Liquid Crystal Displays (LCDs)Liquid Crystal Displays (LCDs)

• LCDs: organic molecules, naturally in crystalline LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or E fieldstate, that liquefy when excited by heat or E field

• Crystalline state twists polarized light 90ºCrystalline state twists polarized light 90º

Liquid Crystal Displays (LCDs)Liquid Crystal Displays (LCDs)

• LCDs: organic molecules, naturally in crystalline LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or E fieldstate, that liquefy when excited by heat or E field

• Crystalline state twists polarized light 90ºCrystalline state twists polarized light 90º

Liquid Crystal Display (LCD)

Figure 2.16 from Hearn and Baker

Display Technology: DMD / DLP

Digital Micromirror Devices (projectors) or Digital Micromirror Devices (projectors) or Digital Light ProcessingDigital Light Processing

• Microelectromechanical (MEM) devices, fabricated Microelectromechanical (MEM) devices, fabricated with VLSI techniqueswith VLSI techniques

Digital Micromirror Devices (projectors) or Digital Micromirror Devices (projectors) or Digital Light ProcessingDigital Light Processing

• Microelectromechanical (MEM) devices, fabricated Microelectromechanical (MEM) devices, fabricated with VLSI techniqueswith VLSI techniques

Display Technology: DMD / DLP

• DMDs are truly digital pixelsDMDs are truly digital pixels

• Vary grey levels by modulating pulse lengthVary grey levels by modulating pulse length

• Color: multiple chips, or color-wheelColor: multiple chips, or color-wheel

• Great resolutionGreat resolution

• Very brightVery bright

• Flicker problemsFlicker problems

• DMDs are truly digital pixelsDMDs are truly digital pixels

• Vary grey levels by modulating pulse lengthVary grey levels by modulating pulse length

• Color: multiple chips, or color-wheelColor: multiple chips, or color-wheel

• Great resolutionGreat resolution

• Very brightVery bright

• Flicker problemsFlicker problems

Display Technologies: Organic LED Arrays

Organic Light-Emitting Diode (OLED) ArraysOrganic Light-Emitting Diode (OLED) Arrays

• The display of the future? Many think so.The display of the future? Many think so.

• OLEDs function like regular semiconductor LEDsOLEDs function like regular semiconductor LEDs

• But they emit lightBut they emit light

– Thin-film deposition of organic, light-Thin-film deposition of organic, light-emitting molecules through vapor emitting molecules through vapor sublimation in a vacuum.sublimation in a vacuum.

– Dope emissive layers with fluorescent Dope emissive layers with fluorescent molecules to create color.molecules to create color.

Organic Light-Emitting Diode (OLED) ArraysOrganic Light-Emitting Diode (OLED) Arrays

• The display of the future? Many think so.The display of the future? Many think so.

• OLEDs function like regular semiconductor LEDsOLEDs function like regular semiconductor LEDs

• But they emit lightBut they emit light

– Thin-film deposition of organic, light-Thin-film deposition of organic, light-emitting molecules through vapor emitting molecules through vapor sublimation in a vacuum.sublimation in a vacuum.

– Dope emissive layers with fluorescent Dope emissive layers with fluorescent molecules to create color.molecules to create color.

http://www.kodak.com/global/en/professional/products/specialProducts/OEL/creating.jhtml

Display Technologies: Organic LED Arrays

OLED pros:OLED pros:• TransparentTransparent

• FlexibleFlexible

• Light-emitting, and quite bright (daylight visible)Light-emitting, and quite bright (daylight visible)

• Large viewing angleLarge viewing angle

• Fast (< 1 microsecond off-on-off)Fast (< 1 microsecond off-on-off)

• Can be made large or smallCan be made large or small

• Available for cell phones and car stereosAvailable for cell phones and car stereos

OLED pros:OLED pros:• TransparentTransparent

• FlexibleFlexible

• Light-emitting, and quite bright (daylight visible)Light-emitting, and quite bright (daylight visible)

• Large viewing angleLarge viewing angle

• Fast (< 1 microsecond off-on-off)Fast (< 1 microsecond off-on-off)

• Can be made large or smallCan be made large or small

• Available for cell phones and car stereosAvailable for cell phones and car stereos

Display Technologies: Organic LED Arrays

OLED cons:OLED cons:• Not very robust, display lifetime a key issueNot very robust, display lifetime a key issue

• Currently only passive matrix displaysCurrently only passive matrix displays

– Passive matrix:Passive matrix: Pixels are illuminated in scanline Pixels are illuminated in scanline order (like a raster display), but the lack of order (like a raster display), but the lack of phospherescence causes flickerphospherescence causes flicker

– Active matrix:Active matrix: A polysilicate layer provides thin film A polysilicate layer provides thin film transistors at each pixel, allowing direct pixel transistors at each pixel, allowing direct pixel access and constant illuminationaccess and constant illumination

See See http://www.howstuffworks.com/lcd4.htmhttp://www.howstuffworks.com/lcd4.htm for more info for more info

OLED cons:OLED cons:• Not very robust, display lifetime a key issueNot very robust, display lifetime a key issue

• Currently only passive matrix displaysCurrently only passive matrix displays

– Passive matrix:Passive matrix: Pixels are illuminated in scanline Pixels are illuminated in scanline order (like a raster display), but the lack of order (like a raster display), but the lack of phospherescence causes flickerphospherescence causes flicker

– Active matrix:Active matrix: A polysilicate layer provides thin film A polysilicate layer provides thin film transistors at each pixel, allowing direct pixel transistors at each pixel, allowing direct pixel access and constant illuminationaccess and constant illumination

See See http://www.howstuffworks.com/lcd4.htmhttp://www.howstuffworks.com/lcd4.htm for more info for more info

Additional Displays

Display WallsDisplay Walls

• PrincetonPrinceton

• StanfordStanford

• UVa – Greg HumphreysUVa – Greg Humphreys

Display WallsDisplay Walls

• PrincetonPrinceton

• StanfordStanford

• UVa – Greg HumphreysUVa – Greg Humphreys

Display Wall Alignment

Additional Displays

StereoStereoStereoStereo

Interfaces

What is spatial dimensionality of computer What is spatial dimensionality of computer screen?screen?

What is dimensionality of mouse input?What is dimensionality of mouse input?

How many degrees of freedom (DOFs) define the How many degrees of freedom (DOFs) define the position of your hand in space?position of your hand in space?

• Space ballSpace ball

What is spatial dimensionality of computer What is spatial dimensionality of computer screen?screen?

What is dimensionality of mouse input?What is dimensionality of mouse input?

How many degrees of freedom (DOFs) define the How many degrees of freedom (DOFs) define the position of your hand in space?position of your hand in space?

• Space ballSpace ball

Video Controllers

Graphics HardwareGraphics Hardware

• Frame buffer is anywhereFrame buffer is anywherein system memoryin system memory

Graphics HardwareGraphics Hardware

• Frame buffer is anywhereFrame buffer is anywherein system memoryin system memory

System Bus

CPU Video Controller

System Memory

Monitor

Frame bufferCartesian

Coordinates

Video Controllers

Graphics HardwareGraphics Hardware

• Permanent place forPermanent place forframe bufferframe buffer

• Direct connection toDirect connection tovideo controllervideo controller

Graphics HardwareGraphics Hardware

• Permanent place forPermanent place forframe bufferframe buffer

• Direct connection toDirect connection tovideo controllervideo controller

System Bus

CPU Video Controller

System Memory Monitor

Frame bufferCartesian

Coordinates

FrameBuffer

Video Controllers

The need for The need for synchronizationsynchronizationThe need for The need for synchronizationsynchronization

System Bus

CPU Video Controller

System Memory MonitorFrame

Buffer

synchronized

Video Controllers

The need for The need for synchronizationsynchronization

• Double bufferingDouble buffering

The need for The need for synchronizationsynchronization

• Double bufferingDouble buffering

System Bus

CPU Video Controller

System Memory MonitorDouble

Buffer

synchronized

previouscurrent

Raster Graphics Systems

DisplayProcessorDisplay

ProcessorSystem

MemorySystem

MemoryCPUCPU

FrameBufferFrameBuffer

MonitorVideoController

VideoController

System Bus

I/O Devices

Figure 2.29 from Hearn and Baker

Frame Buffer

Frame Buffer Figure 1.2 from Foley et al.

Frame Buffer Refresh

Figure 1.3 from FvDFH Refresh rate is usually 30-75Hz

DAC

Direct Color Framebuffer

Store the actual intensities of R, G, and B individually in the Store the actual intensities of R, G, and B individually in the framebufferframebuffer

24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue

• 16 bits per pixel = ? bits red, ? bits green, ? bits blue

Store the actual intensities of R, G, and B individually in the Store the actual intensities of R, G, and B individually in the framebufferframebuffer

24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue

• 16 bits per pixel = ? bits red, ? bits green, ? bits blue

Color Lookup Framebuffer

Store indices (usually 8 bits) in framebufferStore indices (usually 8 bits) in framebuffer

Display controller looks up the R,G,B values before triggering Display controller looks up the R,G,B values before triggering the electron gunsthe electron guns

Store indices (usually 8 bits) in framebufferStore indices (usually 8 bits) in framebuffer

Display controller looks up the R,G,B values before triggering Display controller looks up the R,G,B values before triggering the electron gunsthe electron guns

Frame Buffer

DACPixel color = 14

Color LookupTable

0

1024

14R G B

Software

Hide the detailsHide the details• User should not need to worry about how graphics are User should not need to worry about how graphics are

displayed on monitordisplayed on monitor

• User doesn’t need to know about how a line is converted into User doesn’t need to know about how a line is converted into pixels and drawn on screen (hardware dependent)pixels and drawn on screen (hardware dependent)

• User doesn’t need to rebuild the basic tools of a 3D sceneUser doesn’t need to rebuild the basic tools of a 3D scene

– Virtual camera, light sources, polygon drawingVirtual camera, light sources, polygon drawing

OpenGL does this for you…OpenGL does this for you…

Hide the detailsHide the details• User should not need to worry about how graphics are User should not need to worry about how graphics are

displayed on monitordisplayed on monitor

• User doesn’t need to know about how a line is converted into User doesn’t need to know about how a line is converted into pixels and drawn on screen (hardware dependent)pixels and drawn on screen (hardware dependent)

• User doesn’t need to rebuild the basic tools of a 3D sceneUser doesn’t need to rebuild the basic tools of a 3D scene

– Virtual camera, light sources, polygon drawingVirtual camera, light sources, polygon drawing

OpenGL does this for you…OpenGL does this for you…

Software

Hide the detailsHide the details

• User doesn’t need to know how to read the data coming from User doesn’t need to know how to read the data coming from the mousethe mouse

• User doesn’t need to know how to read the keystrokesUser doesn’t need to know how to read the keystrokes

OpenGL Utility Toolkit (GLUT) does this for you…OpenGL Utility Toolkit (GLUT) does this for you…

Hide the detailsHide the details

• User doesn’t need to know how to read the data coming from User doesn’t need to know how to read the data coming from the mousethe mouse

• User doesn’t need to know how to read the keystrokesUser doesn’t need to know how to read the keystrokes

OpenGL Utility Toolkit (GLUT) does this for you…OpenGL Utility Toolkit (GLUT) does this for you…

Software

Hide the detailsHide the details

• User doesn’t have to build a graphical user interface (GUI)User doesn’t have to build a graphical user interface (GUI)

– Pull-down menus, scrollbars, file loadersPull-down menus, scrollbars, file loaders

Fast Light Toolkit (FLTK) does this for you…Fast Light Toolkit (FLTK) does this for you…

Hide the detailsHide the details

• User doesn’t have to build a graphical user interface (GUI)User doesn’t have to build a graphical user interface (GUI)

– Pull-down menus, scrollbars, file loadersPull-down menus, scrollbars, file loaders

Fast Light Toolkit (FLTK) does this for you…Fast Light Toolkit (FLTK) does this for you…

Software

Hide the detailsHide the details

• User shouldn’t have to write code to create a GUIUser shouldn’t have to write code to create a GUI

– Positioning text boxes, buttons, scrollbarsPositioning text boxes, buttons, scrollbars

– Use a graphical tool to arrange visuallyUse a graphical tool to arrange visually

– Assign callback functions to hook into source codeAssign callback functions to hook into source code

Fast Light User Interface Designer (FLUID) does Fast Light User Interface Designer (FLUID) does this for you…this for you…

Hide the detailsHide the details

• User shouldn’t have to write code to create a GUIUser shouldn’t have to write code to create a GUI

– Positioning text boxes, buttons, scrollbarsPositioning text boxes, buttons, scrollbars

– Use a graphical tool to arrange visuallyUse a graphical tool to arrange visually

– Assign callback functions to hook into source codeAssign callback functions to hook into source code

Fast Light User Interface Designer (FLUID) does Fast Light User Interface Designer (FLUID) does this for you…this for you…

OpenGL Design Goals

SGI’s design goals for OpenGL:SGI’s design goals for OpenGL:

• High-performance (hardware-accelerated) graphics APIHigh-performance (hardware-accelerated) graphics API

• Some hardware independence Some hardware independence

• Natural, terse API with some built-in extensibilityNatural, terse API with some built-in extensibility

OpenGL has become a standard (competing with DirectX) because:OpenGL has become a standard (competing with DirectX) because:

• It doesn’t try to do too muchIt doesn’t try to do too much

– Only renders the image, doesn’t manage windows, etc.Only renders the image, doesn’t manage windows, etc.

– No high-level animation, modeling, sound (!), etc.No high-level animation, modeling, sound (!), etc.

• It does enoughIt does enough

– Useful rendering effects + high performanceUseful rendering effects + high performance

• Open source and promoted by SGI (& Microsoft, half-heartedly)Open source and promoted by SGI (& Microsoft, half-heartedly)

SGI’s design goals for OpenGL:SGI’s design goals for OpenGL:

• High-performance (hardware-accelerated) graphics APIHigh-performance (hardware-accelerated) graphics API

• Some hardware independence Some hardware independence

• Natural, terse API with some built-in extensibilityNatural, terse API with some built-in extensibility

OpenGL has become a standard (competing with DirectX) because:OpenGL has become a standard (competing with DirectX) because:

• It doesn’t try to do too muchIt doesn’t try to do too much

– Only renders the image, doesn’t manage windows, etc.Only renders the image, doesn’t manage windows, etc.

– No high-level animation, modeling, sound (!), etc.No high-level animation, modeling, sound (!), etc.

• It does enoughIt does enough

– Useful rendering effects + high performanceUseful rendering effects + high performance

• Open source and promoted by SGI (& Microsoft, half-heartedly)Open source and promoted by SGI (& Microsoft, half-heartedly)

The Big Picture

Who gets control of the main control loop?Who gets control of the main control loop?• FLTKFLTK – the code that waits for user input and processes it – the code that waits for user input and processes it

– Must be responsive to user… Must be responsive to user… do as I saydo as I say

• GLUTGLUT – the code that controls the window and refresh – the code that controls the window and refresh

– Must be responsive to windowing system and OSMust be responsive to windowing system and OS

• OpenGLOpenGL – the code that controls what is drawn – the code that controls what is drawn

– Must be responsive to the program that specifies where Must be responsive to the program that specifies where objects are located. If something moves, I want to see it.objects are located. If something moves, I want to see it.

Who gets control of the main control loop?Who gets control of the main control loop?• FLTKFLTK – the code that waits for user input and processes it – the code that waits for user input and processes it

– Must be responsive to user… Must be responsive to user… do as I saydo as I say

• GLUTGLUT – the code that controls the window and refresh – the code that controls the window and refresh

– Must be responsive to windowing system and OSMust be responsive to windowing system and OS

• OpenGLOpenGL – the code that controls what is drawn – the code that controls what is drawn

– Must be responsive to the program that specifies where Must be responsive to the program that specifies where objects are located. If something moves, I want to see it.objects are located. If something moves, I want to see it.

The Big Picture

Who gets control of the main control loop?Who gets control of the main control loop?

• Answer: FLTKAnswer: FLTK

– We’ll try to hide the details from you for nowWe’ll try to hide the details from you for now

– But be aware of the conflict that existsBut be aware of the conflict that exists

• FLTK must be aware of GLUT and OpenGL state at all timesFLTK must be aware of GLUT and OpenGL state at all times

– Must give code compute cycles when neededMust give code compute cycles when needed

• We’ll discuss OpenGL as if it were standaloneWe’ll discuss OpenGL as if it were standalone

Who gets control of the main control loop?Who gets control of the main control loop?

• Answer: FLTKAnswer: FLTK

– We’ll try to hide the details from you for nowWe’ll try to hide the details from you for now

– But be aware of the conflict that existsBut be aware of the conflict that exists

• FLTK must be aware of GLUT and OpenGL state at all timesFLTK must be aware of GLUT and OpenGL state at all times

– Must give code compute cycles when neededMust give code compute cycles when needed

• We’ll discuss OpenGL as if it were standaloneWe’ll discuss OpenGL as if it were standalone

Review

Read Chapter 2Read Chapter 2

Read Appendix 1 – 5 (for next week)Read Appendix 1 – 5 (for next week)

Implement OpenGLImplement OpenGL

• Section 2.9 is good introduction to OpenGLSection 2.9 is good introduction to OpenGL

Read Chapter 2Read Chapter 2

Read Appendix 1 – 5 (for next week)Read Appendix 1 – 5 (for next week)

Implement OpenGLImplement OpenGL

• Section 2.9 is good introduction to OpenGLSection 2.9 is good introduction to OpenGL