Lecture 2: Some definitions of terms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 

Slides:



Advertisements
Similar presentations
OpenGL: Simple Use Open a window and attach OpenGL to it Set projection parameters (e.g., field of view) Setup lighting, if any Main rendering loop –Set.
Advertisements

Line and Curve Drawing Algorithms. Line Drawing x0x0 y0y0 x end y end.
Introduction to Programming
Chapter 2: Graphics Programming
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
Lab 1: OpenGL Tutorial CS 282. What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions.
1 Lecture 6 Attributes of graphical primitives Colors Colors in OpenGL Algorithms for scan-conversion.
OpenGL and WebGL Drawing Functions CSCI 440 Day Five.
Computer Graphics CS 385 February 7, Fundamentals of OpenGl and Glut Today we will go through the basics of a minimal OpenGl Glut project, explaining.
OpenGL Brian Farrimond Robina Hetherington. What is OpenGL A specification of a set of functions for drawing graphics –Names of functions –What information.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Reference1. [OpenGL course slides by Rasmus Stenholt]
CS380 LAB I OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
Lecture 3: Transforms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Lecture 7: Objects and Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Computing & Information Sciences Kansas State University CIS 536/636 Introduction to Computer Graphics Lecture 6 of 41 William H. Hsu Department of Computing.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
INTRO TO COMPUTER GRAPHICS TEXT EDWARD ANGEL: EDITION 5 CS770/870
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
Lecture 8: Texture Mapping 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Lecture 9: Lighting and Shading 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Interactive Computer Graphics CS 418 – Spring 2015 Mesh Rendering, Transformation, Camera Viewing and Projection in OpenGL TA: Zhicheng Yan Sushma S Kini.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
1. OpenGL/GLU/GLUT  OpenGL v4.0 (latest) is the “core” library that is platform independent  GLUT v3.7 is an auxiliary library that handles window creation,
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
CD2012 Principles of Interactive Graphics Lecture 01 Introduction Abir Hussain (Rome: 6.33,Tel , Web:
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CGMB214: Introduction to Computer Graphics
Lecture 11: Exam Revision 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271  Coursework.
Introduction to Computer Graphics 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Introduction to OpenGL. OpenGL is a low-level graphics library specification. It makes available to the programmer  a small set of geometric primitives.
1 A first OpenGL program Brian Farrimond Robina Hetherington.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
Intro to OpenGL: Vertices and Drawing
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
NoufNaief.net TA: Nouf Al-harbi.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
NoufNaief.net 1 TA: Nouf Al-Harbi.
Graphics: Conceptual Model
Lecture 2 Review OpenGL Libraries Graphics Overview Rendering Pipeline OpenGL command structure.
Chapter 4 -- Color1 Color Open GL Chapter 4. Chapter 4 -- Color2 n The goal of almost all OpenGL applications is to draw color pictures in a window on.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
Introduction to Graphics Programming. Graphics API.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
The Human Visual System vs The Pinhole camera
Introduction to OpenGL
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
Primitive Objects Lecture 6 Wed, Sep 5, 2007.
Color and Shading Lecture 9 Mon, Sep 26, 2005.
Computer Graphics Practical Lesson 1-
Introduction to OpenGL
Shapes.
Presentation transcript:

Lecture 2: Some definitions of terms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271  Circle and Ellipse drawing algorithms - Extract from Chapter 2 of OpenGL Programming Guide

Lecture 2: Some definitions of terms 2 Today’s Lecture and Lab  Review of Tutorial 1  Lab: any problems?  Some definitions of basic terms in OpenGL  Outline of today’s tutorial:  drawing circles and ellipses

Lecture 2: Some definitions of terms 3 Review of Tutorial  From last week’s tutorial you should be able to  Compile a Visual C++ OpenGL program  Change the position of a point (vertex), pp  Change the background colour, pp  Change the colour of the drawn object, pp 32  Change the way vertices are joined, pp 43-47

Lecture 2: Some definitions of terms 4 In the lab  If you are having problems check that your M: drive is not full  Examples will compile on machines in the 6 th and 7 th floor labs but not the 3 rd floor  If you are having M: drive problems even after deleting files check with the Computer Desk in the ARC

Lecture 2: Some definitions of terms 5 Defining some terms: Vertex  A vertex is the basic building block in OpenGL  It is a point in space defined by x, y, z and w  We can forget w until level 3, and z for a few weeks X Y Z

Lecture 2: Some definitions of terms 6 Ways of Drawing Vertices  Most function names in OpenGL begin with gl followed by the name of the operation and then the number and type of the parameters, e.g.  glVertex2s(2,3);two integers  glVertex3d(0.0, 0.0, ); three doubles  glVertex3f(15.0, 12.0, 5.0);three floats  Gldouble dvect[3] = {5.0, 9.0, 12.6}  glVertex3dv(dvect) an array of points  We might use the latter to draw a collection of stored points

Lecture 2: Some definitions of terms 7 Ways of Drawing Vertices ….  As you saw in last weeks tutorial, more complex shapes are made by joining vertices together in different ways  This is controlled by the parameter passed to glBegin() see pages of the handout  The different attributes, GL_POINTS, GL_LINES can be used to draw different shapes  However different attributes may also been used because  The data was scanned and stored as points, triangles or quads  or, some 3d algorithms, depend on the way the data is stored, e.g. lighting and collision detection

Lecture 2: Some definitions of terms 8 Representing Colour  One of the main colour representing models in Computer Graphics is to use Red, Green and Blue components in a pixel  By adding more or less of each component we can control the colour drawn e.g.  Red 0, Green 0, Blue 0 == Black  Red 1, Green 0, Blue 0 == Red  Red 1, Green 1, Blue 0 == Yellow  Red 0, Green 1, Blue 1 == Cyan  Red 1, Green 1, Blue 1 == White  (More examples on page 33 of handout)

Lecture 2: Some definitions of terms 9 Representing Colour...  In OpenGL the colour component is controlled by values between 0.0 and 1.0  To set the current drawing colour we call  glColor3f(r, g, b) where r, g and b are floating point numbers between 0.0 and 1.0 representing red, green and blue.  We can also set the background colour using  glClearColor(red, green, blue, alpha)  Alpha is used to control transparency and is zero in our examples

Lecture 2: Some definitions of terms 10 Graphics Context: The OpenGL State Machine  You may have observed that points and shapes are draw in a colour until you change the colour via a call to glColor*()  The colour state is retained during drawing operations  In fact, all drawing states are retained until they are changed by the appropriate function call  Drawing is done in the current Graphics Context and the same state machine approach is used by all graphics libraries: OpenGL, Windows, Macintosh, X Windows

Lecture 2: Some definitions of terms 11 Graphics Context: Other Attributes  Other attributes which control the current graphics context are  Primitive Drawing mode: GL_POINTS etc  Colour  Point sizeglPointSize(float)  Line WidthglLineWidth(float)  Line StyleglLineStipple(int, short) pages  Operations on the current drawing matrix which control scale, translation and rotation (level 3)  A common error in programming is to forget to change the graphics context when required

Lecture 2: Some definitions of terms 12 Today’s Tutorial: Circle Drawing  OpenGL does not have a primitive function for drawing circles  The handout has a fairly inefficient routine using floating point numbers and calls to cos() and sin()  The attached algorithms (from Foley and van Dam) use either integer only (Circle) or integer and some floats (Ellipse) to draw shapes more efficiently  Implement these two algorithms in OpenGL: replace CirclePoints() and EllipsePoints() by calls to glVertex*() and glColor(). Note use symmetry to draw all points.

Lecture 2: Some definitions of terms 13 Next Week  More drawing with  scaling, rotation and translation  Resources for your PC  the GLUT library can be found at See the Readme file on where to put components  Using GLUT with Borland C++

Lecture 2: Some definitions of terms 14 Other resources  OpenGL tutorials However, most assume knowledge of Windows API  GLUT sample code 3.5/progs/progs.html