1 / 23

Chapter 1: Introduction

Chapter 1: Introduction. Admin: Lecture slots : Monday 8-9:45, Tuesday 9:15-11:00. Book : F. Hill, Computer Graphics Using OpenGL (Little Big Bookstore) Evaluation : 3hr closed book, 8 th week (50%) + weekly pracs (50%) Pracs : Windows or Linux, OpenGL. CAREFUL when using 3D Studio Max.

quincy
Download Presentation

Chapter 1: Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1: Introduction • Admin: • Lecture slots: Monday 8-9:45, Tuesday 9:15-11:00. • 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. CS Hons RW778 Graphics

  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 09:00 CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  5. Chapter 1: Introduction • Edge, vertex, polygon, simple polygon • Attributes: color, thickness, dashing, endpoint blending CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  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) CS Hons RW778 Graphics

  8. Chapter 1: Introduction • 1.3.5 Shades of gray and color in raster images • Pixel depth : n bits => 2n values (at least 256) • Smaller pixel depth => loss in quality. Banding. • Color: RGB • Color depth => 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 CS Hons RW778 Graphics

  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. CS Hons RW778 Graphics

  10. Chapter 1: Introduction • Some hardware (video monitor) requires “refresh” : entire frame buffer scanned out to display many times per second. CS Hons RW778 Graphics

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

  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. CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  14. Chapter 2: Drawing in OpenGL #include <gl/Gl.h> #include <gl/glut.h> //<<<<<<<<<<<<<<<<<<<<<<<< main >>>>>>>>>>>>>>>>>>>>>> void main(int argc, char** argv) { // initialize // create screen window glutDisplayFunc (myDisplay); glutMouseFunc (myMouse); glutKeyboardFunc (myKeyboard); glutMainLoop(); // go into a perpetual loop } CS Hons RW778 Graphics

  15. Chapter 2: Drawing in OpenGL • 2.1.3 Opening a window for drawing (framework) #include <gl/Gl.h> #include <gl/glut.h> //<<<<<<<<<<<<<<<<<<<<<<<< main >>>>>>>>>>>>>>>>>>>>>> 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 } CS Hons RW778 Graphics

  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 (…) CS Hons RW778 Graphics

  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(); CS Hons RW778 Graphics

  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(); CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  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. 60—61. CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  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 CS Hons RW778 Graphics

  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 08:00) • No copying/cheating • Accompanying report to be handed in at demo CS Hons RW778 Graphics

More Related