Comp4422. Computer Graphics. Lab 02: WebGL API Prof. George Baciu. PQ838 x7272.

Size: px
Start display at page:

Download "Comp4422. Computer Graphics. Lab 02: WebGL API Prof. George Baciu. PQ838 x7272."

Transcription

1 Comp4422 Computer Graphics Lab 02: WebGL API Prof. George Baciu PQ838 x7272 9/6/2018 COMP4422 Lab 02 George Baciu

2 WebGL Prerequisites HTML DOM (Document Object Management) JavaScript programming JavaScript-WebGL bindings: Three.js glmatrix.js webgl-utils.js CSS: Cascading Style Sheets 9/6/2018 COMP4422 Lab 02 George Baciu

3 Use Google Chrome 9/6/2018 COMP4422 Lab 02 George Baciu

4 Setting up the Scene Obtain WebGL context Create primitive types Create buffer objects (VBOs) Create attributes Two-dimensional static rendering Create a program and shaders Set up the view matrices Add animation and movement 9/6/2018 COMP4422 Lab 02 George Baciu

5 Html Canvas HTML5 <!doctype html> <html> <head> <title>a blank canvas</title> <style> body { background-color: grey; } canvas { background-color: white; } </style> </head> <body> <canvas id="my-canvas" width="400" height="300"> Your browser does not support the HTML5 canvas element. </canvas> </body> </html> 9/6/2018 COMP4422 Lab 02 George Baciu

6 If HTML5 is NOT supported Your browser does not support the HTML5 canvas element. 9/6/2018 COMP4422 Lab 02 George Baciu

7 If HTML5 is NOT supported Then, you get: Your browser does not support the HTML5 canvas element. 9/6/2018 COMP4422 Lab 02 George Baciu

8 Otherwise, you get 9/6/2018 COMP4422 Lab 02 George Baciu

9 Exercise Change the canvas size to 1024 x x /6/2018 COMP4422 Lab 02 George Baciu

10 Setting up WebGL Define a JavaScript setup function that is called once when the window DOM is loaded. 9/6/2018 COMP4422 Lab 02 George Baciu

11 <!doctype html> <html> <head> </html> </head> <body> </body> <title>a blank canvas</title> <style> body canvas </style> <script> { background-color: grey; } { background-color: white; } window.onload = setupwebgl; var gl = null; function setupwebgl() { var canvas = document.getelementbyid( my-canvas ); try { gl = canvas.getcontext( experimental-webgl ); } } </script> <canvas id="my-canvas" width="400" height="300"> Your browser does not support the HTML5 canvas element. </canvas> 9/6/2018 COMP4422 Lab 02 George Baciu

12 WebGL Components Drawing buffers Primitive types 9/6/2018 COMP4422 Lab 02 George Baciu

13 Drawing Buffers A color buffer A depth buffer A stencil buffer 9/6/2018 COMP4422 Lab 02 George Baciu

14 What is a buffer? A block of memory for temporarily storing data 9/6/2018 COMP4422 Lab 02 George Baciu

15 The Color Buffer The color buffer stores values (usually 8 bits) for each of the three color components: Red Green Blue 9/6/2018 COMP4422 Lab 02 George Baciu

16 Primitive Types Points Lines Triangles 9/6/2018 COMP4422 Lab 02 George Baciu

17 Seven ways to render POINTS LINES LINE_STRIP LINE_LOOP 9/6/2018 COMP4422 Lab 02 George Baciu

18 Seven ways to render TRIANGLES TRIANGLE_STRIP TRIANGLE_FAN 9/6/2018 COMP4422 Lab 02 George Baciu

19 Obtain Context For setting background color For drawing points/triangles... 9/6/2018 COMP4422 Lab 02 George Baciu

20 Obtain Context <!doctype html> <html> <head> <title>a blank canvas</title> <style> body { background-color: grey; } canvas { background-color: white; } </style> </head> <body> <canvas id="my-canvas" width="400" height="300"> Your browser does not support the HTML5 canvas element. </canvas> </body> JavaScript Code <script> // Getting Context </script> </html> 9/6/2018 COMP4422 Lab 02 George Baciu

21 Obtain Context <script> window.onload = setupwebgl; var gl = null; function setupwebgl() { var canvas = document.getelementbyid("my-canvas"); gl = canvas.getcontext("experimental-webgl"); if(gl) { //set the clear color to red gl.clearcolor(1.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); }else{ alert( "Error: Your browser does not appear to support WebGL."); } } </script> Enable Color Writing 9/6/2018 COMP4422 Lab 02 George Baciu

22 You get 9/6/2018 COMP4422 Lab 02 George Baciu

23 Exercise Change the canvas background color Black color Green color Blue color Alpha value 9/6/2018 COMP4422 Lab 02 George Baciu

24 Drawing Triangle Vertex Buffer Shader Primitive Type 9/6/2018 COMP4422 Lab 02 George Baciu

25 Drawing Triangle Vertex Buffer var trianglevertices = [ //top triangle -0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, //bottom triangle -0.5, -0.5, 0.0, 0.0, 0.0, 0.0, 0.5, -0.5, 0.0 ]; 9/6/2018 COMP4422 Lab 02 George Baciu

26 Drawing Triangle Shader Vertex Shader Fragment Shader 9/6/2018 COMP4422 Lab 02 George Baciu

27 Drawing Triangle Shader Script (Vertex) <script id="shader-vs" type="x-shader/x-vertex"> attribute vec3 avertexposition; void main(void) { gl_position = vec4(avertexposition, 1.0); } </script> 9/6/2018 COMP4422 Lab 02 George Baciu

28 Drawing Triangle Shader Script (Fragment) <script id="shader-fs" type="x-shader/x-fragment"> void main(void) { gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } </script> 9/6/2018 COMP4422 Lab 02 George Baciu

29 Drawing Triangle Primitive Type 9/6/2018 COMP4422 Lab 02 George Baciu

30 Drawing Triangle Primitive Type gl.drawarrays(gl.triangles, 0, 6); 9/6/2018 COMP4422 Lab 02 George Baciu

31 Drawing Triangle Code Structure initwebgl setupwebgl initbuffers initshaders drawscene 9/6/2018 COMP4422 Lab 02 George Baciu

32 You get 9/6/2018 COMP4422 Lab 02 George Baciu

33 Exercise Draw four triangles Change the triangle color 9/6/2018 COMP4422 Lab 02 George Baciu

34 Adding Color Setup ColorBuffer var triangleverticecolors = [ //top left triangle 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, //bottom right triangle 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0 ]; 9/6/2018 COMP4422 Lab 02 George Baciu

35 Adding Color Change Shader Script (Vertex) <script id="shader-vs" type="x-shader/x-vertex"> attribute vec3 avertexposition; attribute vec3 avertexcolor; varying highp vec4 vcolor; void main(void) { gl_position = vec4(avertexposition, 1.0); vcolor = vec4(avertexcolor, 1.0); } </script> 9/6/2018 COMP4422 Lab 02 George Baciu

36 Adding Color Change Shader Script (Fragment) <script id="shader-fs" type="x-shader/x-fragment"> varying highp vec4 vcolor; void main(void) { gl_fragcolor = vcolor; } </script> 9/6/2018 COMP4422 Lab 02 George Baciu

37 Adding Color drawscene vertexcolorattribute = gl.getattriblocation(glprogram, "avertexcolor"); gl.enablevertexattribarray(vertexcolorattribute); gl.bindbuffer(gl.array_buffer, trianglescolorbuffer); gl.vertexattribpointer(vertexcolorattribute, 3, gl.float, false, 0, 0); numberofcomponents type normalizeflag stride offset 9/6/2018 COMP4422 Lab 02 George Baciu

38 You get 9/6/2018 COMP4422 Lab 02 George Baciu

39 Exercise Change the triangle color Set constant color in Vertex Shader Script 9/6/2018 COMP4422 Lab 02 George Baciu

40 Animation updatebuffers var x_translation = Math.sin(angle)/2.0; var trianglevertices = [ //left triangle x_translation, 0.5, 0.0, x_translation, 0.0, 0.0, x_translation, -0.5, 0.0, //right triangle x_translation, 0.5, 0.0, x_translation, 0.0, 0.0, x_translation, -0.5, 0.0 ]; 9/6/2018 COMP4422 Lab 02 George Baciu

41 Animation requestanimationframe window.requestanimframe = (function(){ return window.requestanimationframe window.webkitrequestanimationframe window.mozrequestanimationframe window.orequestanimationframe window.msrequestanimationframe function( callback ){ //define the interval time window.settimeout(callback, 1000 / 60); }; })(); 9/6/2018 COMP4422 Lab 02 George Baciu

42 Animation animloop setupwebgl(); updatebuffers(); drawscene(); requestanimframe(animloop, canvas); 9/6/2018 COMP4422 Lab 02 George Baciu

43 You get 9/6/2018 COMP4422 Lab 02 George Baciu

44 Exercise Create color animation 9/6/2018 COMP4422 Lab 02 George Baciu

45 Download: 9/6/2018 COMP4422 Lab 02 George Baciu

46 Try things out 9/6/2018 COMP4422 Lab 02 George Baciu

Introduction to OpenGL/GLSL and WebGL GLSL

Introduction to OpenGL/GLSL and WebGL GLSL Introduction to OpenGL/GLSL and WebGL GLSL Objectives! Give you an overview of the software that you will be using this semester! OpenGL, WebGL, and GLSL! What are they?! How do you use them?! What does

More information

Programming with OpenGL Complete Programs Objectives Build a complete first program

Programming with OpenGL Complete Programs Objectives Build a complete first program Programming with OpenGL Complete Programs Objectives Build a complete first program Introduce shaders Introduce a standard program structure Simple viewing Two-dimensional viewing as a special case of

More information

BCA611 Video Oyunları için 3B Grafik

BCA611 Video Oyunları için 3B Grafik BCA611 Video Oyunları için 3B Grafik WebGL - Shader Programming Zümra Kavafoğlu Canvas element The HTML element is used to draw graphics on a web page. Create canvas with id, width and height

More information

WebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group

WebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group WebGL: Hands On DevCon5 NYC 2011 Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group Today's Agenda Introduce WebGL and its programming model. Show code for a complete example. Demonstrate

More information

Rasterization-based pipeline

Rasterization-based pipeline Rasterization-based pipeline Interactive Graphics: Color and Images 10/2/2014 Pagina 1 Rasterization-based rendering Input: set of vertices and its associated attributes Algorithm goes through several

More information

Web-Based Visualization

Web-Based Visualization Web-Based Visualization Web-Based Visualization 11-1 Motivation Nowadays, web browser become more and more capable of displaying graphical content. Different packages are available for creating such content,

More information

CS452/552; EE465/505. Image Formation

CS452/552; EE465/505. Image Formation CS452/552; EE465/505 Image Formation 1-15-15 Outline! Image Formation! Introduction to WebGL, continued Draw a colored triangle using WebGL Read: Angel, Chapters 2 & 3 Homework #1 will be available on

More information

WebGL A quick introduction. J. Madeira V. 0.2 September 2017

WebGL A quick introduction. J. Madeira V. 0.2 September 2017 WebGL A quick introduction J. Madeira V. 0.2 September 2017 1 Interactive Computer Graphics Graphics library / package is intermediary between application and display hardware Application program maps

More information

WebGL. Creating Interactive Content with WebGL. Media #WWDC14. Session 509 Dean Jackson and Brady Eidson WebKit Engineers

WebGL. Creating Interactive Content with WebGL. Media #WWDC14. Session 509 Dean Jackson and Brady Eidson WebKit Engineers Media #WWDC14 WebGL Creating Interactive Content with WebGL Session 509 Dean Jackson and Brady Eidson WebKit Engineers 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics.

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics. About the Tutorial WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics. This tutorial starts with a basic introduction

More information

Mining the Rendering Power in Web Browsers. Jianxia Xue Jan. 28, 2014

Mining the Rendering Power in Web Browsers. Jianxia Xue Jan. 28, 2014 Mining the Rendering Power in Web Browsers Jianxia Xue Jan. 28, 2014 Outline Web application as software deployment platform WebGL: Graphics API inside browsers Explore browser rendering capability through

More information

Programming with WebGL Part 1: Background. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Programming with WebGL Part 1: Background. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Programming with WebGL Part 1: Background CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley

More information

Objectives. Programming with WebGL Part 1: Background. Retained vs. Immediate Mode Graphics. Early History of APIs. PHIGS and X.

Objectives. Programming with WebGL Part 1: Background. Retained vs. Immediate Mode Graphics. Early History of APIs. PHIGS and X. Objectives Programming with WebGL Part 1: Background CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Development of the OpenGL API OpenGL Architecture - OpenGL

More information

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Models and Architectures 1 Objectives Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for an interactive graphics system 2 Image Formation Revisited

More information

I Can t Believe It s Not

I Can t Believe It s Not I Can t Believe It s Not Flash! @thomasfuchs Animating CSS properties Timer JavaScript sets CSS Reflow Rendering Paint Animating CSS properties Timer JavaScript sets CSS Reflow

More information

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015 WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

OPENGL RENDERING PIPELINE

OPENGL RENDERING PIPELINE CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript

More information

OpenGL shaders and programming models that provide object persistence

OpenGL shaders and programming models that provide object persistence OpenGL shaders and programming models that provide object persistence COSC342 Lecture 22 19 May 2016 OpenGL shaders We discussed forms of local illumination in the ray tracing lectures. We also saw that

More information

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October WebGL and GLSL Basics CS559 Fall 2016 Lecture 14 October 24 2016 Review Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

CS452/552; EE465/505. Overview of Computer Graphics

CS452/552; EE465/505. Overview of Computer Graphics CS452/552; EE465/505 Overview of Computer Graphics 1-13-15 Outline! What is Computer Graphics? a historical perspective! Draw a triangle using WebGL Computer Graphics! Computer graphics deals with all

More information

WebGL Game Development

WebGL Game Development WebGL Game Development Sumeet Arora Chapter No. 1 "Getting Started with WebGL Game Development" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter

More information

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd. PROFESSIONAL WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB Andreas Anyuru WILEY John Wiley & Sons, Ltd. INTRODUCTION xxl CHAPTER 1: INTRODUCING WEBGL 1 The Basics of WebGL 1 So Why Is WebGL So Great?

More information

2D graphics with WebGL

2D graphics with WebGL 2D graphics with WebGL Some material contained here is adapted from the book s slides. September 7, 2015 (Dr. Mihail) 2D graphics September 7, 2015 1 / 22 Graphics Pipeline (Dr. Mihail) 2D graphics September

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job

More information

Lecture 11 Shaders and WebGL. October 8, 2015

Lecture 11 Shaders and WebGL. October 8, 2015 Lecture 11 Shaders and WebGL October 8, 2015 Review Graphics Pipeline (all the machinery) Program Vertex and Fragment Shaders WebGL to set things up Key Shader Concepts Fragment Processing and Vertex

More information

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS SESSION 12 PROGRAMMABLE SHADERS Announcement Programming Assignment #2 deadline next week: Session #7 Review of project proposals 2 Lecture Overview GPU programming 3 GPU Pipeline

More information

CS452/552; EE465/505. Image Processing Frame Buffer Objects

CS452/552; EE465/505. Image Processing Frame Buffer Objects CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1

More information

CS452/552; EE465/505. Review & Examples

CS452/552; EE465/505. Review & Examples CS452/552; EE465/505 Review & Examples 2-05 15 Outline Review and Examples:! Shaders, Buffers & Binding! Example: Draw 3 Triangles Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Example:

More information

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40) 11(40) Information Coding / Computer Graphics, ISY, LiTH OpenGL where it fits what it contains how you work with it 11(40) OpenGL The cross-platform graphics library Open = Open specification Runs everywhere

More information

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer

More information

CPSC 436D Video Game Programming

CPSC 436D Video Game Programming CPSC 436D Video Game Programming OpenGL/Shaders Opengl RENDERING PIPELINE Copyright: Alla Sheffer 1 Opengl RENDERING PIPELINE C/C++ OpenGL GLSL (automatic) (automatic) GLSL (automatic) opengl Low-level

More information

WebGL Seminar: O3D. Alexander Lokhman Tampere University of Technology

WebGL Seminar: O3D. Alexander Lokhman Tampere University of Technology WebGL Seminar: O3D Alexander Lokhman Tampere University of Technology What is O3D? O3D is an open source JavaScript API for creating rich, interactive 3D applications in the browser Created by Google and

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Rongkai Guo Assistant Professor at Computer Game Design program Kennesaw State University 1 Overview These lectures are for a senior/graduate elective for computer

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico 1 Overview These

More information

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University Graphics Programming Computer Graphics, VT 2016 Lecture 2, Chapter 2 Fredrik Nysjö Centre for Image analysis Uppsala University Graphics programming Typically deals with How to define a 3D scene with a

More information

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 4: Three Dimensions

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 4: Three Dimensions Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 4: Three Dimensions Objectives Develop a bit more sophisticated three-dimensional example - Rotating cube Introduce hidden-surface

More information

WebGL. Announcements. WebGL for Graphics Developers. WebGL for Web Developers. Homework 5 due Monday, 04/16. Final on Tuesday, 05/01

WebGL. Announcements. WebGL for Graphics Developers. WebGL for Web Developers. Homework 5 due Monday, 04/16. Final on Tuesday, 05/01 Announcements Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2012 Homework 5 due Monday, 04/16 In-class quiz Wednesday, 04/18 Final on Tuesday, 05/01 6-8pm David Rittenhouse Lab A7 Networking

More information

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012 Copyright Khronos Group 2012 Page 1 Teaching GL Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012 Copyright Khronos Group 2012 Page 2 Agenda Overview of OpenGL family of APIs Comparison

More information

Visual HTML5. Human Information Interaction for Knowledge Extraction, Interaction, Utilization, Decision making HI-I-KEIUD

Visual HTML5. Human Information Interaction for Knowledge Extraction, Interaction, Utilization, Decision making HI-I-KEIUD Visual HTML5 1 Overview HTML5 Building apps with HTML5 Visual HTML5 Canvas SVG Scalable Vector Graphics WebGL 2D + 3D libraries 2 HTML5 HTML5 to Mobile + Cloud = Java to desktop computing: cross-platform

More information

CS452/552; EE465/505. Shadow Mapping in WebGL

CS452/552; EE465/505. Shadow Mapping in WebGL CS452/552; EE465/505 Shadow Mapping in WebGL 4-09 15 Outline! Shadow Mapping in WebGL Switching Shaders Framebuffer Objects (FBO) Read: Angel, Chapter 7: 7.12 Framebuffer Objects WebGL Programming Guide:

More information

Game Graphics & Real-time Rendering

Game Graphics & Real-time Rendering Game Graphics & Real-time Rendering CMPM 163, W2018 Prof. Angus Forbes (instructor) angus@ucsc.edu Lucas Ferreira (TA) lferreira@ucsc.edu creativecoding.soe.ucsc.edu/courses/cmpm163 github.com/creativecodinglab

More information

COPYRIGHTED MATERIAL. 1Introducing WebGL THE BASICS OF WEBGL

COPYRIGHTED MATERIAL. 1Introducing WebGL THE BASICS OF WEBGL Introducing WebGL WHAT S IN THIS CHAPTER? The basics of WebGL Wh 3D graphics in the browser offer great possibilities How to work with an immediate-mode API The basics of graphics hardware The WebGL graphics

More information

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J. CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL

More information

CS475/CS675 - Computer Graphics. OpenGL Drawing

CS475/CS675 - Computer Graphics. OpenGL Drawing CS475/CS675 - Computer Graphics OpenGL Drawing What is OpenGL? Open Graphics Library API to specify geometric objects in 2D/3D and to control how they are rendered into the framebuffer. A software interface

More information

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system GRAPHICS PIPELINE 1 OUTLINE Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system 2 IMAGE FORMATION REVISITED Can we mimic the synthetic

More information

Ciril Bohak. - INTRODUCTION TO WEBGL

Ciril Bohak. - INTRODUCTION TO WEBGL 2016 Ciril Bohak ciril.bohak@fri.uni-lj.si - INTRODUCTION TO WEBGL What is WebGL? WebGL (Web Graphics Library) is an implementation of OpenGL interface for cmmunication with graphical hardware, intended

More information

Water Simulation on WebGL and Three.js

Water Simulation on WebGL and Three.js The University of Southern Mississippi The Aquila Digital Community Honors Theses Honors College 5-2013 Water Simulation on WebGL and Three.js Kerim J. Pereira Follow this and additional works at: http://aquila.usm.edu/honors_theses

More information

Over the past 15 years, OpenGL has become

Over the past 15 years, OpenGL has become Editors: Beatriz Sousa Santos and Ginger Alford The Case for Teaching Computer Graphics with WebGL: A 25-Year Perspective Ed Angel University of New Mexico Over the past 15 years, OpenGL has become the

More information

Get your port on! porting to Native Client as of Pepper 18. Colt "MainRoach" McAnlis

Get your port on! porting to Native Client as of Pepper 18. Colt MainRoach McAnlis Get your port on! porting to Native Client as of Pepper 18 Colt "MainRoach" McAnlis 3.05.2012 Getting Started gonacl.com It works! Native Client runs C++ code in a web page No plug-in required The Gist

More information

INTRODUCTION TO OPENGL PIPELINE

INTRODUCTION TO OPENGL PIPELINE CS580: Computer Graphics Min H. Kim KAIST School of Computing Foundations of Computer Graphics INTRODUCTION TO OPENGL PIPELINE 2 1 What is OpenGL? OpenGL = Open Graphics Library An open industry-standard

More information

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Rendering Pipeline Rendering Pipeline Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Pipeline 18.10.2013 Steiner- Wallner- Podaras

More information

Qiufeng Zhu Advanced User Interface Spring 2017

Qiufeng Zhu Advanced User Interface Spring 2017 Qiufeng Zhu Advanced User Interface Spring 2017 Brief history of the Web Topics: HTML 5 JavaScript Libraries and frameworks 3D Web Application: WebGL Brief History Phase 1 Pages, formstructured documents

More information

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York Shadows Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce Shadow Algorithms Expand to projective textures 2 Flashlight in the Eye Graphics When do we not see

More information

Introductory Seminar

Introductory Seminar EDAF80 Introduction to Computer Graphics Introductory Seminar OpenGL & C++ Michael Doggett 2017 C++ slides by Carl Johan Gribel, 2010-13 Today Lab info OpenGL C(++)rash course Labs overview 5 mandatory

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 2 Part 1 Primitives and Buffers Matt Burlick - Drexel University - CS 432 1 Rendering in OpenGL Ok, so now we want to actually draw stuff! OpenGL (like most

More information

DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW. By Felix Klein

DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW. By Felix Klein DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW By Felix Klein 1 THE WEB IS READY FOR AR Fast JavaScript WebGL, WebCL getusermedia, WebRTC Geolocation, Orientation, Motion > Any Problem? WEBGL: POWERFUL AND

More information

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL Today s Agenda Basic design of a graphics system Introduction to OpenGL Image Compositing Compositing one image over another is most common choice can think of each image drawn on a transparent plastic

More information

Lewis Weaver. Nell Waliczek. Software Engineering Lead. Program github.

Lewis Weaver. Nell Waliczek. Software Engineering Lead. Program  github. Nell Waliczek Software Engineering Lead Lewis Weaver Program Manager @NellWaliczek github.com/nellwaliczek @lew_weav github.com/leweaver Mixed Reality on the web using WebVR Available October 17 th WebVR

More information

Content. Building Geometry Appearance Lights Model Loaders

Content. Building Geometry Appearance Lights Model Loaders Content Building Geometry Appearance Lights Model Loaders Building Geometry A Geometry represents a 3D object: Mesh: The form or structure of a shape (What to draw) Material: The color, transparency, and

More information

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Lecture Overview! Review

More information

CMSC427 OpenGL and JOGL

CMSC427 OpenGL and JOGL CMSC427 OpenGL and JOGL Step 1: Configuring and compiling In Eclipse following previous instructions Get from web page CMSC427OpenGLCode.zip Add graphics3dlib.jar to JOGL project From command line Add

More information

We assume that you are familiar with the following:

We assume that you are familiar with the following: We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell phones and tablets. See http://webglstats.com/. We will

More information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Introduction to Computer Graphics. April 6, 2017 Kenshi Takayama

Introduction to Computer Graphics. April 6, 2017 Kenshi Takayama Introduction to Computer Graphics April 6, 2017 Kenshi Takayama Lecturers Kenshi Takayama (Assistant Prof., NII) http://research.nii.ac.jp/~takayama/ takayama@nii.ac.jp Toshiya Hachisuka (Junior Associate

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most

More information

Web Programming 1 Packet #5: Canvas and JavaScript

Web Programming 1 Packet #5: Canvas and JavaScript Web Programming 1 Packet #5: Canvas and JavaScript Name: Objectives: By the completion of this packet, students should be able to: use JavaScript to draw on the canvas element Canvas Element. This is a

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Fri, Aug 28, 2015 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 1 / 19 Outline 1 Vertices 2 The

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel The Mandelbrot Set Fractals Fractal (fractional geometry) objects generate some of the most complex and beautiful graphics - The mathematics describing

More information

JavaScript. Interpolated points

JavaScript. Interpolated points GLSL WebGL is a combination of JavaScript and GLSL providing commands that allow access to and control the GPU via shader programs. What is a Shader? A program which is compiled and run on the GPU. Shaders

More information

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016 Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016 In brief Starting with a simple model In brief Caveat : Issues with sampling & aliasing associate texture coordinates with primitives

More information

WebGL. WebGL. Bring 3D to the Masses. WebGL. The web has text, images, and video. We want to support. Put it in on a webpage

WebGL. WebGL. Bring 3D to the Masses. WebGL. The web has text, images, and video. We want to support. Put it in on a webpage WebGL WebGL Patrick Cozzi University of Pennsylvania CIS 565 - Fall 2012 The web has text, images, and video What is the next media-type? We want to support Windows, Linux, Mac Desktop and mobile 2 Bring

More information

Picking (In WebGL) Picking idea

Picking (In WebGL) Picking idea 9. Picking IN THIS CHAPTER Selecting objects in a WebGL scene using the mouse Creating and using offscreen framebuffers What renderbuffers are and how they are used by framebuffers Reading pixels from

More information

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments. Web Development WEB101: Web Development Fundamentals using HTML, CSS and JavaScript $2,495.00 5 Days Replay Class Recordings included with this course Upcoming Dates Course Description This 5-day instructor-led

More information

Computação Gráfica. Computer Graphics Engenharia Informática (11569) 3º ano, 2º semestre. Chap. 4 Windows and Viewports

Computação Gráfica. Computer Graphics Engenharia Informática (11569) 3º ano, 2º semestre. Chap. 4 Windows and Viewports Computação Gráfica Computer Graphics Engenharia Informática (11569) 3º ano, 2º semestre Chap. 4 Windows and Viewports Outline : Basic definitions in 2D: Global coordinates (scene domain): continuous domain

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Wed, Aug 23, 2017 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 1 / 19 Outline 1 Vertices 2 The

More information

Mobile Application Programing: Android. OpenGL Operation

Mobile Application Programing: Android. OpenGL Operation Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another

More information

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3 COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3 MODULE 1: OVERVIEW OF HTML AND CSS This module provides an overview of HTML and CSS, and describes how to use Visual Studio 2012

More information

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1)

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1) Computer Graphics (CS 4731) Lecture 2: Introduction to OpenGL/GLUT(Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL GLBasics OpenGL s function Rendering

More information

GLSL 1: Basics. J.Tumblin-Modified SLIDES from:

GLSL 1: Basics. J.Tumblin-Modified SLIDES from: GLSL 1: Basics J.Tumblin-Modified SLIDES from: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico and

More information

CS452/552; EE465/505. Models & Viewing

CS452/552; EE465/505. Models & Viewing CS452/552; EE465/505 Models & Viewing 2-03 15 Outline! Building Polygonal Models Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Viewing Classical Viewing Read: Viewing in Web3D Angel, Section

More information

-1, -1, 0, 1, 1, //first corner: -> bottom left of the viewport -1, 1, 1, 1, 1, //top left of the viewport 1, 1, 0, 0, 0 //top right of the viewport

-1, -1, 0, 1, 1, //first corner: -> bottom left of the viewport -1, 1, 1, 1, 1, //top left of the viewport 1, 1, 0, 0, 0 //top right of the viewport WebGL Academy Correction GL = CANVAS.getContext("experimental-webgl", {antialias: false); Both Edge and IE still require "experimental-webgl". 1. 2D coloured triangle Exercises Add a second triangle to

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 3: Shaders Objectives Basic shaders - Vertex shader - Fragment shader Programming shaders with GLSL Finish first program void init(void)

More information

OPENGL AND GLSL. Computer Graphics

OPENGL AND GLSL. Computer Graphics OPENGL AND GLSL Computer Graphics 1 OUTLINE I. Detecting GLSL Errors II. Drawing a (gasp) Triangle! III. (Simple) Animation 2 Interactive Computer Graphics, http://www.mechapen.com/projects.html WHAT IS

More information

Web Site Development with HTML/JavaScrip

Web Site Development with HTML/JavaScrip Hands-On Web Site Development with HTML/JavaScrip Course Description This Hands-On Web programming course provides a thorough introduction to implementing a full-featured Web site on the Internet or corporate

More information

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL CS4621/5621 Fall 2015 Computer Graphics Practicum Intro to OpenGL/GLSL Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang

More information

Web API for Vehicle Data RI

Web API for Vehicle Data RI Web API for Vehicle RI Reference implementation of Web API for Vehicle 1. Objective 2. Architecture Overview 2.1. The relation of Web API with the other GENIVI components 2.2. The organization of this

More information

Fundamentals of Website Development

Fundamentals of Website Development Fundamentals of Website Development CSC 2320, Fall 2015 The Department of Computer Science In this chapter History of HTML HTML 5-2- 1 The birth of HTML HTML Blows and standardization -3- -4-2 HTML 4.0

More information

Computer Graphics Lecture 2

Computer Graphics Lecture 2 1 / 16 Computer Graphics Lecture 2 Dr. Marc Eduard Frîncu West University of Timisoara Feb 28th 2012 2 / 16 Outline 1 Graphics System Graphics Devices Frame Buffer 2 Rendering pipeline 3 Logical Devices

More information

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags Recap on HTML and creating our template file Introduction

More information

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12 Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES

More information

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Objectives Shader Programming Basics Simple Shaders Vertex shader Fragment shaders

More information

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer Best practices for effective OpenGL programming Dan Omachi OpenGL Development Engineer 2 What Is OpenGL? 3 OpenGL is a software interface to graphics hardware - OpenGL Specification 4 GPU accelerates rendering

More information

CS452/552; EE465/505. Transformations

CS452/552; EE465/505. Transformations CS452/552; EE465/55 Transformations 1-29-15 Outline! Transformations Read: Angel, Chapter 4 (study cube.html/cube.js example) Helpful links: Linear Algebra: Khan Academy Lab1 is posted on github, due:

More information

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures

More information

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics Sean Ellis Consultant Graphics Engineer ARM, Maidenhead Introduction M3G 1.x Recap ARM M3G Integration M3G 2.0 Update

More information

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping CISC 3620 Lecture 7 Lighting and shading Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping Exam results Grade distribution 12 Min: 26 10 Mean: 74 8 Median:

More information