MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:

Slides:



Advertisements
Similar presentations
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
Advertisements

Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Projective Texture Mapping
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
1 Understanding of OpenGL TA: Dong Hyun Jeong Instructor : Dr. Kalpathi Subramanian Texture Mapping.
TEXTURE MAPPING JEFF CHASTINE 1. TEXTURE MAPPING Applying an image (or a texture ) to geometry 2D images (rectangular) 3D images (volumetric – such as.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 4 : GLSL Shaders Topics: Shader programs, vertex & fragment shaders, passing data into.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 5 : GLSL Shaders Topics: Shader syntax, passing textures into shaders, per-pixel lighting,
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - MAT 594CM Forums (Ritesh) - Problem Set #1 online, due April 15th - Need.
OpenGL Son of the Survival Guide. Last Time on OpenGL Windowing … glut Rendering Primatives Transformations Projections State Management.
Shadow Mapping RTR Team Why Shadows? 2 RTR Team 2009.
Computer Graphics (Spring 2008) COMS 4160, Lecture 14: OpenGL 3
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
OpenGL (II). How to Draw a 3-D object on Screen?
Surface Rendering With OpenGL CS460 Project by Rui Yu 11/30/03.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 OpenGL Basics A Graphics Standard ©Mel Slater, Anthony Steed
Computer Graphics Texture Mapping Eriq Muhammad Adams
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Geometric transformations The Pipeline
2IV60 Computer Graphics set 10: Texture mapping Jack van Wijk TU/e.
Lecture 8: Texture Mapping 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Module 04 – Texture mapping, Texture filtering, Lighting and Blending Module 04 Texture mapping, Texture filtering, Lighting and Blending.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
WebGL: in-browser 3D graphics Nick Whitelegg Maritme and Technology Faculty Southampton Solent University.
CS 450: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CS380 LAB IV OpenGL Jonghyeob Lee Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CG1 Labs Wei Li. Back Face Culling // enable back-face culling glEnable( GL_CULL_FACE ); // orientation of front-facing polygons glFrontFace( GL_CCW );
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.
Review of OpenGL Basics
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Control flow for interactive applications CSE 3541 Matt Boggus.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
MP3 Frequently Asked Questions (IN OFFICE HOURS).
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
School of Computer Science
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Day 05 Shader Basics.
Models and Architectures
Computer Graphics 4Practical Lesson
Models and Architectures
Presentation transcript:

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics: shapes, lighting, textures - Pushing/Popping modelview stacks Problem Set 1, due April 13th: 1. create a Camera class which allows users to navigate 3D space interactively 2. create a scene graph data structure 3a. create an interactive visual space that emulates existing work 3b. create an animated version of the above

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Vertex and Fragment Operations Last week we talked about how a vertex is transformed from 3D space to a 2D projection onto a display by multiplying it through the graphics pipeline. The pipeline is split into two operations: vertex operations and pixel (or fragment) operations. Vertex operations control the position of geometry. Fragment operations control the way the geometry looks (ie, lighting, blending, texturing), ultimately specifying a color for each pixel. OpenGL gives you limited control over how your GPU executes these operations. GLSL shader programs give you more control.

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes OpenGL environments Most OpenGL environments simplify the management of the OpenGL context within a windowed application. init (happens once) set up camera lens / projection matrix initialize lighting load textures from disk reshape (happens when screen is resized) re-set projection matrix based on new size of screen display (happens 60 times per second) position camera position drawing cursor coordinates draw stuff listen for mouse, keyboard, etc

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes init projection matrix Define camera attributes and set Projection matrix - glViewport, usually just the screen bounds - glPerspective, usually near,far =.1, 100; fovy=45, aspect ratio = w/h or use glFrustum or create an array of floats and load it using glLoadMatrix

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes init lighting glLightfv defines one of the characteristics for one of the lights ambient = general background light diffuse = light from a source that scatters uniformly when it bounces off an object specular = light from a source that scatters in a particular direction //enable lighting glEnable(GL_LIGHTING); // define a light glEnable(GL_LIGHT1); glLightfv(GL_LIGHT1, GL_AMBIENT, ambient, 0); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse, 0); glLightfv(GL_LIGHT1, GL_POSITION, lightPosition, 0);

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes load textures Loading textures by hand is kind of a pain. OpenGL environments generally provide helper methods. a texture is just an array of data, can be used for images, depth maps, luminance maps, etc 1.enable textures and generate texture ids 2.bind a specific texture id 3.load image from disk 4.put it into a texture object – usually 2D, RGBA format 5.set texture attributes (eg, linear filtering, clamping) textures are copied directly onto the video card, so drawing them is “hardware- accelerated” glEnable(GL_TEXTURE_2D); glGenTextures(3, int[], 0); //bind 3 textures to IDs glBindTexture(GL_TEXTURE_2D, textures[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(textures[0], 0, GL_RGBA, imgWidth, imgHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgPixelData);

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes drawing textures To draw a texture you “bind” it to your geometry and then position it in relation to vertices. Texture coordinates are always normalized to between 0 and 1. glBindTexture(GL_TEXTURE_2D, textureID); gl.glBegin(GL2.GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glEnd();

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Pushing and Popping the Modelview These are convenience methods to let you save state during drawing. - set up camera view by moving the cursor 10 units away glTranslate3f(0f, 0f, -10f) -store this view glPushMatrix(); -do something which changes the modelview matrix glRotatef(45f, 0f, 1f, 0f); glScale3f(2f,.5f, 0f); glTranslate3f(1f, -2f, 3f); (draw stuff...) -return to nice simple view glPopMatrix(); You can nest a large number of these modelviews on the stack with no loss of performance. Used in scene graphs.