OpenGL and WebGL Drawing Functions CSCI 440 Day Five.

Slides:



Advertisements
Similar presentations
2IV60 Computer graphics Graphics primitives and attributes Jack van Wijk TU/e.
Advertisements

 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
OpenGL (Graphics Library) Software Interface to graphics software Allows to create interactive programs that produce color images of moving 3D objects.
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
1 Lecture 4 Graphical primitives Rasterization: algorithmic approach Rasterization: geometric approach 2D discrete lines, triangles Discrete planes 3D.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
Computer Graphics Lecture 1 July 11, Computer Graphics What do you think of? The term “computer graphics” is a blanket term used to refer to the.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
WebGL: in-browser 3D graphics Nick Whitelegg Maritme and Technology Faculty Southampton Solent University.
Computer Graphics CS 385 January 31, Fractals Some definitions Object which is self-similar at all scales. Regardless of scale the same level of.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Color on Computers. Bits and Bytes Bit: a single piece of yes/no or 0/1 data Two bits can code 4 items (00, 01, 10, 11) Three bits = 8 (000, 001, 010,
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 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
به نام خدا تنظیم کننده : فرانه حدادی استاد : مهندس زمانیان تابستان 92.
P RACTICING O PEN GL- P RIMITIVES. O PEN GL O UTPUT P RIMITIVES  Each geometric object is described by a set of vertices and the type of primitive to.
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Computer Graphics Bing-Yu Chen National Taiwan University.
Lecture 2: Some definitions of terms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Geometry Shader (GLSL)
1 Graphics CSCI 343, Fall 2015 Lecture 3 Introduction to WebGL.
Vertex Buffer Objects and Shader Attributes. For Further Reading Angel 7 th Ed: –Most parts of Chapter 2. Beginning WebGL: –Chapter 1: vertex Buffer Objects,
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
What are Computer Graphics Basically anything that is on you Monitor – This includes the text that you will see Text isn’t Advanced Graphics But…. Understanding.
PART TWO Electronic Color & RGB values 1. Electronic Color Computer Monitors: Use light in 3 colors to create images on the screen Monitors use RED, GREEN,
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 4: Color and Attributes Isaac Gang University.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
 There are 3 primary colors of light RED, GREEN, & BLUE  When these colors of light are mixed… White Light is produced  This process is called color.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
CSC Graphics Programming
Introduction to OpenGL
Programming with OpenGL Part 2: Complete Programs
Objectives Simple Shaders Programming shaders with GLSL
Programming with OpenGL Part 2: Complete Programs
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Introduction to Computer Graphics with WebGL
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
Objectives OpenGL drawing primitives and attributes
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 4: Color and Attributes
Introduction to Computer Graphics with WebGL
Colour Theories.
Drawing in the plane 455.
Two ways to discuss color 1) Addition 2) Subtraction
Color and Shading Lecture 9 Mon, Sep 26, 2005.
What Color is it?.
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 3: Shaders
Programming with OpenGL Part 4: Color and Attributes
Introduction to OpenGL
Programming with OpenGL Part 2: Complete Programs
OpenGL-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

OpenGL and WebGL Drawing Functions CSCI 440 Day Five

OpenGL History SGI Inc – current - Khronos consortium OpenGL 2.0 replaced 1.5 – added the GLSL shader language OpenGL 3.0 replaced 2.1 – removed glBegin and glEnd – deprecated many vertex and fragment functions – basis of WebGL OpenGL 4.5 – direct support of many graphics cards

State Machine OpenGL, and hence WebGL, is a State Machine Example: – We do not draw a "red triangle" – we set the drawing color state to red, then draw a triangle – anything drawn after that will also be red until we change the drawing color state Some functions set states, other functions query the current state

OpenGL v. JavaScript Types – JavaScript uses dynamic typing – OpenGL is very picky about data types Object Oriented – neither WebGL nor OpenGL is OO

OpenGL v WebGL OpenGLWebGL Text Points Varying Point Types Lines Line Styles Polygons Unfilled Polygons Filled Polygons Triangles Unfilled Triangle

WebGL Drawing Types  gl.POINTS  gl.LINES  gl.LINE_STRIP  gl.LINE_LOOP  gl.TRIANGLES  gl.TRIANGLE_STRIP  gl.TRIANGLE_FAN gl.drawArrays ( gl.TRIANGLES, 0, 3 );

Line Types Angel figure 2.7

Triangle Types Angel figures 2.13 & 14

Making Polygons out of Triangles Angel figures 2.17 & 18

Line and Triangle Attributes There are very few. – line width does not always work – triangle strips are always filled – etc. Textures can be applied to produce fill effects and line types.

Point Attributes In the JavaScript: gl.enable(gl.VERTEX_PROGRAM_POINT_SIZE); gl.enable(gl.POINT_SMOOTH); // rounded In the Vertex Shader: uniform float pointSize; void main(void) { gl_PointSize = pointSize;

ColorColorColorColor The real world uses Subtractive Color – bricks appear red because the surface is absorbing all colors except red – the street appears black because it is absorbing all colors – Primary Colors = Red Blue Yellow Computers use Additive Color – "no color" equals black – combining all colors makes white – Primary Colors = Red Green Blue

How can I make these filled shapes?

How can I make these shapes?

Next Classes 6.Input Principles 7.Input Code 8.Matrix Math