Chapter 1: Introduction - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Chapter 1: Introduction

Description:

Book: F. Hill, Computer Graphics Using OpenGL (Little Big Bookstore) Evaluation: 3hr closed book, 8th week (50 ... The Big Dipper. The Sierpinski Gasket ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 24
Provided by: Lyne1
Category:

less

Transcript and Presenter's Notes

Title: Chapter 1: Introduction


1
Chapter 1 Introduction
  • Admin
  • Lecture slots Monday 8-945, Tuesday 915-1100.
  • Book F. Hill, Computer Graphics Using OpenGL
    (Little Big Bookstore)
  • Evaluation 3hr closed book, 8th week (50)
    weekly pracs (50)
  • Pracs Windows or Linux, OpenGL. CAREFUL when
    using 3D Studio Max.
  • This is a fun course, but also a LOT of hard
    work.

2
Chapter 1 Introduction
  • Week 1 Introduction and OpenGL (Hill, Ch. 1,2).
  • Week 2 Windows and viewports vector tools
    (Hill, Ch. 3,4).
  • Week 3 Vector tools (continued) (Hill, Ch. 4).
  • Week 4 Transformations on objects (Hill, Ch. 5).
  • Week 5 Polygonal meshes (Hill, Ch. 6).
  • Week 6 3D viewing (Hill, Ch. 7).
  • Week 7 Lighting and face realism (Hill, Ch. 8).
  • Week 8 Exam Wednesday 0900

3
Chapter 1 Introduction
  • 1.1 What is computer graphics (CG)?
  • Simply pictures
  • Tools
  • Field of study
  • 1.2 Where is CG used?
  • Art, entertainment, publishing
  • Image processing
  • Process monitoring, simulations, CAD
  • Scientific visualization

4
Chapter 1 Introduction
  • 1.3 Elements of pictures created in CG
  • Output primitives and attributes
  • Polylines
  • Text
  • Filled regions
  • Raster images
  • 1.3.1 Polylines
  • Connected sequence of straight lines

5
Chapter 1 Introduction
  • Edge, vertex, polygon, simple polygon
  • Attributes color, thickness, dashing, endpoint
    blending

6
Chapter 1 Introduction
  • 1.3.2 Text
  • Font, color, size, spacing, orientation
  • Tilting (graphs)
  • 1.3.3 Filled regions
  • Filled shape boundary (polygon)
  • Filling used for shadow effects

7
Chapter 1 Introduction
  • 1.3.4 Raster image
  • Consists of cells (called pixels) with color
    value
  • Stored as array of numerical values
  • Bitmap 0-1
  • Created as hand-designed, or computed, or
    scanned.
  • Computed straight lines jaggies
  • Easy manipulation (filters, cleanup)

8
Chapter 1 Introduction
  • 1.3.5 Shades of gray and color in raster images
  • Pixel depth n bits gt 2n values (at least 256)
  • Smaller pixel depth gt loss in quality. Banding.
  • Color RGB
  • Color depth gt sum of bits for each color
  • High quality (true color) 24 bits (eye
    perception)
  • 1.4 Graphics Display Devices
  • 1.4.1 Line drawing (plotters) cross-hatching

9
Chapter 1 Introduction
  • 1.4.2 Raster displays (video monitor, flat-panel
    displays, printers)
  • Display surface (X,Y)
  • Frame buffer memory to hold display pixels,
    with scan controller.

10
Chapter 1 Introduction
  • Some hardware (video monitor) requires refresh
    entire frame buffer scanned out to display many
    times per second.

11
Chapter 1 Introduction
  • Video monitors
  • CRT
  • Digital-to-analog converters (DACs)
  • Refresh 60x per second to prevent flicker.
  • Scanning per line

12
Chapter 1 Introduction
  • 1.4.3 Indexed Color and the LUT
  • Programmable association between pixel value and
    color
  • Bits in frame buffer acts as index into LUT.
  • Palette set of possible colors AT ONE TIME.
  • 1.4.4 Other raster display devices flat-panel,
    LCD, active matrix panels, plasma panel
  • 1.4.5 Hard-copy raster devices film recorder,
    laser printer, inkjet plotter. PostScript.
  • 1.5 Graphics input primitives and devices
  • Selfstudy.

13
Chapter 2 Drawing in OpenGL
  • 2.1 Getting started
  • Environment window, coordinate system,
    elementary drawing routines
  • 2.1.1 Device-independence and OpenGL
  • Libraries
  • 2.1.2 Windows-based Programming
  • Event-driven, event queue and callbacks
  • System-dependent (glut)
  • Example Fig. 2.2

14
Chapter 2 Drawing in OpenGL
  • include ltgl/Gl.hgt
  • include ltgl/glut.hgt
  • //ltltltltltltltltltltltltltltltltltltltltltltltlt main
    gtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgt
  • void main(int argc, char argv)
  • // initialize
  • // create screen window
  • glutDisplayFunc (myDisplay)
  • glutMouseFunc (myMouse)
  • glutKeyboardFunc (myKeyboard)
  • glutMainLoop() // go into a perpetual
    loop

15
Chapter 2 Drawing in OpenGL
  • 2.1.3 Opening a window for drawing (framework)
  • include ltgl/Gl.hgt
  • include ltgl/glut.hgt
  • //ltltltltltltltltltltltltltltltltltltltltltltltlt main
    gtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgtgt
  • void main(int argc, char argv)
  • glutInit(argc, argv) // initialize
    the toolkit
  • glutInitDisplayMode(GLUT_SINGLE GLUT_RGB) //
    set display mode
  • glutInitWindowSize(640,480) // set window
    size
  • glutInitWindowPosition(100, 150) // set window
    position on screen
  • glutCreateWindow("my first attempt") // open
    the screen window
  • glutDisplayFunc(myDisplay) // register
    redraw function
  • myInit()
  • glutMainLoop() // go into a perpetual
    loop

16
Chapter 2 Drawing in OpenGL
  • 2.2 Drawing basic graphics primitives
  • Establish coordinate system
  • Line drawing primitives glBegin, glEnd,
    vertices
  • Example
  • glBegin (GL_POINTS)
  • glVertex2i(100,50)
  • glVertex2i(100,130)
  • glVertex2i(150,130)
  • glEnd()
  • OpenGL commands glVertex2i ()

17
Chapter 2 Drawing in OpenGL
  • OpenGL data types GLint, GLfloat
  • OpenGL state current state variables.
  • glColor3f (red, green, blue)
  • glClear (GL_COLOR_BUFFER_BIT)
  • Establish coordinate system
  • Matrices and transformations (ch. 3)
  • Fig. 2.10 A complete OpenGL program
  • Note glFlush()

18
Chapter 2 Drawing in OpenGL
  • 2.2.1 Drawing dot constellations
  • The Big Dipper
  • The Sierpinski Gasket
  • Simple dot plots (note scaling and shifting,
    which are affine transformations)
  • 2.3 Line Drawings
  • glBegin (GL_LINES)
  • glVertex2i(40, 100)
  • glVertex2i(202, 96)
  • glEnd()

19
Chapter 2 Drawing in OpenGL
  • More than 2 vertices paired
  • 2.3.1 Drawing polylines and polygons
  • Polyline collection of joined line segments,
    specified by ordered list of points.
  • OpenGL GL_LINE_STRIP (open line segment)
  • GL_LINE_LOOP (closed line segment not fillable
    area GL_POLYGON)
  • Examples line graphs, polylines from file,
    parameterizing figures, polyline drawer

20
Chapter 2 Drawing in OpenGL
  • 2.3.2 Line drawing with moveto() and lineto()
  • Current position
  • 2.3.3 Drawing aligned rectangles
  • glRecti(x1,y1,x2,y2)
  • 2.3.4 Aspect ratio of aligned rectangle
  • width/height
  • NB! Work through all practice exercises on pp.
    6061.

21
Chapter 2 Drawing in OpenGL
  • 2.3.5 Filling polygons
  • Must be convex!
  • 2.3.6 Other graphics primitives
  • GL_TRIANGLES,GL_QUADS,GL_TRIANGLE_STRIP
  • GL_TRIANGLE_FAN,GL_QUAD_STRIP

22
Chapter 2 Drawing in OpenGL
  • 2.4 Simple mouse and keyboard interaction
  • glut callbacks on events
  • glutMouseFunc, glutMotionFunc, glutKeyboardFunc
  • 2.4.1 Mouse interaction selfstudy
  • 2.4.2 Keyboard interaction selfstudy
  • 2.6 Case studies SELFSTUDY

23
Chapter 2 Drawing in OpenGL
  • Programming Task 1 Implement Case Study 2.5
    (Polyline Stippling), p. 75, in Hill.
  • Familiarize yourself with OpenGL, Linux (or
    Windows) and C/C.
  • The usual rules for programming projects hold
  • No extensions (demo Monday 0800)
  • No copying/cheating
  • Accompanying report to be handed in at demo
Write a Comment
User Comments (0)
About PowerShow.com