The Projection Matrix
|
|
- Lambert Carpenter
- 6 years ago
- Views:
Transcription
1 The Projection Matrix Lecture 8 Robb T. Koether Hampden-Sydney College Fri, Sep 11, 2015 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
2 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
3 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
4 Homogeneous Coordinates OpenGL performs all of its geometric calculations in 4 dimensions. The 4th coordinate w is called the homogeneous coordinate. We will see later the role that it plays. For now, w should always be 1. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
5 Homogeneous Coordinates When working in 2 dimensions (x, y) or 3 dimensions (x, y, z), OpenGL will use all 4 dimensions (x, y, z, w). In the xy-plane, z = 0 and w = 1. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
6 World Coordinate System The coordinates system that we use to draw objects is the world coordinate system. That system is whatever system we find to be convenient. The world coordinate system is either 2D or 3D, whichever we choose to use. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
7 Normalized Device Coordinate System The coordinate system used in the frame buffer is the normalized device coordinate system. It is a 2-dimensional system, with 1 x 1 and 1 y 1. The projection matrix will convert world coordinates into normalized device coordinates. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
8 Screen Coordinate System In the screen coordinate system, each pixel is one unit. The upper-left corner of the screen is the origin (0, 0). The lower-right corner is determined by the resolution of the screen. If the resolution is , then the lower-right corner is (1680, 1050). Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
9 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
10 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
11 The Projection Matrix The transformations described above can be carried out by multiplying by the projection matrix proj = 2 right left 0 0 right+left right left 2 0 top bottom 0 top+bottom top bottom Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
12 The Projection Matrix Matrix multiplication X = PX will perform the transformation. x 2 y right left 0 0 right+left right left x 0 = 2 0 top bottom 0 top+bottom top bottom y Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
13 The Projection Matrix The Projection Matrix Suppose our scene is drawn in a rectangle with left = 4, right = 4, bottom = 3 and top = 3. Then the projection matrix is Map the point (2, 1). proj = Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
14 The Projection Matrix The Projection Matrix Suppose our scene is drawn in a rectangle with left = 0, right = 8, bottom = 0 and top = 4. Then the projection matrix is Map the point (2, 1). proj = Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
15 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
16 The ortho2d() Function The ortho2d() Function mat4 ortho2d(left, right, bottom, top) The ortho2d() function will create the projection matrix. We must pass it to the vertex shader. The shader must multiply it by the vertex. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
17 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
18 Uniform Shader Variables A uniform shader variable is a shader variable whose value does not change during the processing of the vertices of a primitive, i.e., a call to gldrawarrays(). Its value is set by the application program and passed to the shader. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
19 Uniform Shader Variables Passing a Shader Variable GLint glgetuniformlocation(program, name); In the application program, we must get a location for the uniform variable. The glgetuniformlocation() will return a location. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
20 Uniform Shader Variables Passing a Shader Variable void gluniform*(location, value); void gluniform*(location, count, values); void gluniformmatrix*(location, count, GL_TRUE, values); The functions gluniform*() and gluniformmatrix*() will pass the value(s) to the shaders. The third parameter of gluniformmatrix*() tells whether to take the transpose of the matrix being passed. See p. 48 of the Red Book. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
21 Passing the Projection Matrix Passing the Projection Matrix mat4 proj = ortho2d(left, right, bottom, top); GLuint proj_loc = glgetuniformlocation(program, "proj"); gluniformmatrix4fv(proj_loc, 1, GL_TRUE, proj); This code with create the projection matrix and pass it to the shaders. "proj" is the name of the uniform variable in the shader. It is a good idea to keep the same name in order to avoid confusion. Later, we will have many uniform variables. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
22 Using the Projection Matrix Using the Projection Matrix uniform mat4 proj; layout (location = 0) in vec2 vposition; void main() { gl_position = proj*vec4(vposition, 0.0f, 1.0f); } In the shader program, we simply declare the variable to be uniform. The name must match the name specified in the application program. Then multiply it by the position vector and assign to gl_position. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
23 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
24 Resizing the Window When the window is resized by the user, the reshape() function is automatically called. It is the responsibility of the reshape() function to create a new projection matrix, based on the new dimensions of the window. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
25 The reshape() Function The reshape() Function void reshape(int wid, int hgt) { // Compute new window boundaries. // Compute and transfer projection matrix to shaders proj = ortho2d(left, right, bottom, top); gluniformmatrix4fv(proj_loc, 1, GL_TRUE, proj); }. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
26 Resizing the Window The questions is, how to recompute left, right, bottom, and top? Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
27 Resizing the Window The questions is, how to recompute left, right, bottom, and top? We will label the new values LEFT, RIGHT, BOTTOM, and TOP. Choose a point that is to be fixed. Upper-left corner Lower-left corner Center Etc. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
28 Resizing the Window Suppose we keep the lower-left corner fixed. If the window is expanded, then the expansion will reveal more of the scene to the right and above. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
29 Lower-Left Corner Fixed Lower-Left Corner Fixed TOP WIDTH top width HEIGHT height BOTTOM = bottom LEFT = left right RIGHT Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
30 Lower-Left Corner Fixed left, right, bottom, and top are in world coordinates. width and height are in screen coordinates. Be careful! Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
31 Lower-Left Corner Fixed Clearly, LEFT = left and BOTTOM = bottom. Also, we have the relation RIGHT LEFT right left = WIDTH width. Therefore, RIGHT = LEFT + ( ) WIDTH (right left). width Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
32 Lower-Left Corner Fixed Similarly, TOP = BOTTOM + ( HEIGHT height ) (top bottom). Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
33 The reshape() Function The reshape() Function void reshape(int wid, int hgt) { // Compute new window boundaries float right = left + (float)wid/scr_width*(right - left); float top = bottom + (float)hgt/scr_height*(top - bottom); proj = ortho2d(left, right, bottom, top);. } Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
34 Center Fixed Center Fixed TOP top WIDTH width y height HEIGHT bottom BOTTOM LEFT left x right RIGHT We may keep the center fixed. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
35 Resizing the Window We may keep any point fixed. If the window is expanded, then the expansion will reveal area to the left and right, and the bottom and bottom, in proportion to the fixed point s location. For example, if the point is 1 6 of the way from left to right, then 1 6 of the revealed area will be to the left and 5 6 will be to the right. The same holds in the vertical direction. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
36 Resizing the Window Resizing the Window TOP WIDTH top width height HEIGHT y P bottom BOTTOM LEFT left x right RIGHT Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
37 Lower-Left Corner Fixed To keep the point (x, y) fixed, we must have the relation Therefore, x LEFT x left LEFT = x = WIDTH width. ( ) WIDTH (x left). width Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
38 Lower-Left Corner Fixed The full set of equations is ( ) WIDTH LEFT = x (x left), width ( ) WIDTH RIGHT = x + (right x), width ( ) HEIGHT BOTTOM = y (y bottom), height ( ) HEIGHT TOP = y + (top y). height Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
39 The reshape() Function The reshape() Function void reshape(int wid, int hgt) { // Compute new window boundaries float left = x - (float)wid/scr_width*(x - left); float right = x + (float)wid/scr_width*(right - x); float bottom = y - (float)hgt/scr_height*(y - bottom); float top = y + (float)hgt/scr_height*(top - y); proj = ortho2d(left, right, bottom, top);. } Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
40 Lower-Left Corner Fixed For example, if we wanted to keep the upper-right corner fixed, then x = right, y = top and the equations become ( ) WIDTH LEFT = right (right left), width RIGHT = right, BOTTOM = top TOP = top. ( HEIGHT height ) (top bottom), Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
41 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
42 Assignment 5 Assignment 5 Give the demo program LowerLeftFixed.cpp the new name CenterFixed.cpp. Modify the reshape() function so that the center of the scene remains in the center of the window when the window is resized. Write a program named GameOfLife.cpp that will Draw a square 512 pixels by 512 pixels centered in the window. Draw 33 vertical lines, dividing the square into 32 vertical strips. Draw 33 horizontal lines, dividing the square into little squares. Use colors that contrast pleasingly. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
43 Outline 1 Coordinate Systems 2 The Projection Matrix The Transformation The ortho2d() Function 3 Uniform Shader Variables 4 Resizing the Window 5 Assignment 5 6 Assignment Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
44 Assignment Assignment Read pp , User Transformations. Read pp , Orthographic Projection. Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, / 43
The Projection Matrix
The Projection Matrix Lecture 5 Robb T. Koether Hampden-Sydney College Wed, Aug 30, 2017 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Wed, Aug 30, 2017 1 / 21 Outline 1 The World Coordinate
More informationThe 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 informationThe 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 informationComputer Graphics (4731) Lecture 4: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio)
Computer Graphics (4731) Lecture 4: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Screen Coordinate System
More informationShader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011
Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1
More informationShading Triangles. Lecture 37. Robb T. Koether. Hampden-Sydney College. Mon, Nov 30, 2015
Shading Triangles Lecture 37 Robb T. Koether Hampden-Sydney College Mon, Nov 30, 2015 Robb T. Koether (Hampden-Sydney College) Shading Triangles Mon, Nov 30, 2015 1 / 35 Outline 1 Shading Triangles Barycentric
More informationSpecular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017
Specular Reflection Lecture 19 Robb T. Koether Hampden-Sydney College Wed, Oct 4, 2017 Robb T. Koether (Hampden-Sydney College) Specular Reflection Wed, Oct 4, 2017 1 / 22 Outline 1 Specular Reflection
More informationComputer Graphics (CS 543) Lecture 2b: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio)
Computer Graphics (CS 543) Lecture 2b: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Announcements All code
More informationComputer Graphics (CS 4731) & 2D Graphics Systems
Computer Graphics (CS 4731) Lecture 4: Shader Setup & 2D Graphics Systems Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL Program: Shader Setup initshader(
More informationDensity Curves Sections
Density Curves Sections 3.1-3.2 Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Jan 27, 2016 Robb T. Koether (Hampden-Sydney College) Density CurvesSections 3.1-3.2 Wed, Jan 27, 2016 1 / 18 Outline
More informationThe Model Stack. Lecture 8. Robb T. Koether. Hampden-Sydney College. Wed, Sep 6, 2017
The Model Stack Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Sep 6, 2017 Robb T. Koether (Hampden-Sydney College) The Model Stack Wed, Sep 6, 2017 1 / 19 Outline 1 Drawing Rectangle Man 2 The
More informationApplying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017
Applying Textures Lecture 27 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College) Applying Textures Fri, Nov 3, 2017 1 / 24 Outline 1 Applying Textures 2 Photographs
More informationThe Critical-Path Algorithm
The Critical-Path Algorithm Lecture 32 Sections 8.3-8.4 Robb T. Koether Hampden-Sydney College Wed, Nov 19, 2014 Robb T. Koether (Hampden-Sydney College) The Critical-Path Algorithm Wed, Nov 19, 2014 1
More informationThe Traveling Salesman Problem Brute Force Method
The Traveling Salesman Problem Brute Force Method Lecture 30 Sections 6.1, 6.3 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College)The Traveling Salesman Problem
More informationSolving Recursive Sequences by Iteration
Solving Recursive Sequences by Iteration Lecture 25 Section 5.7 Robb T. Koether Hampden-Sydney College Thu, Feb 28, 2013 Robb T. Koether (Hampden-Sydney College) Solving Recursive Sequences by Iteration
More informationMagnification and Minification
Magnification and Minification Lecture 30 Robb T. Koether Hampden-Sydney College Fri, Nov 6, 2015 Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 1 / 17 Outline
More informationMinimal Spanning Trees
Minimal Spanning Trees Lecture 33 Sections 7.1-7.3 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 20 Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 1 / 17 1 Networks
More informationThe Mesh Class. Lecture 23. Robb T. Koether. Hampden-Sydney College. Wed, Oct 18, 2017
The Mesh Class Lecture 23 Robb T. Koether Hampden-Sydney College Wed, Oct 18, 2017 Robb T. Koether (Hampden-Sydney College) The Mesh Class Wed, Oct 18, 2017 1 / 21 Outline 1 The Mesh Class 2 Assignment
More informationAbstract Data Types. Lecture 23 Section 7.1. Robb T. Koether. Hampden-Sydney College. Wed, Oct 24, 2012
Abstract Data Types Lecture 23 Section 7.1 Robb T. Koether Hampden-Sydney College Wed, Oct 24, 2012 Robb T. Koether (Hampden-Sydney College) Abstract Data Types Wed, Oct 24, 2012 1 / 19 1 Abstract Data
More informationThe View Frustum. Lecture 9 Sections 2.6, 5.1, 5.2. Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2011
The View Frustum Lecture 9 Sections 2.6, 5.1, 5.2 Robb T. Koether Hampden-Sydney College Wed, Sep 14, 2011 Robb T. Koether (Hampden-Sydney College) The View Frustum Wed, Sep 14, 2011 1 / 36 Outline 1 The
More informationThe Pairwise-Comparison Method
The Pairwise-Comparison Method Lecture 10 Section 1.5 Robb T. Koether Hampden-Sydney College Mon, Sep 11, 2017 Robb T. Koether (Hampden-Sydney College) The Pairwise-Comparison Method Mon, Sep 11, 2017
More informationThe Class Construct Part 1
The Class Construct Part 1 Lecture 23 Sections 7.5-7.6 Robb T. Koether Hampden-Sydney College Fri, Oct 26, 2018 Robb T. Koether (Hampden-Sydney College) The Class Construct Part 1 Fri, Oct 26, 2018 1 /
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 17 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Fri, Oct 5, 2018 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Fri, Oct 5,
More informationComp 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 informationwhile Loops Lecture 13 Sections Robb T. Koether Wed, Sep 26, 2018 Hampden-Sydney College
while Loops Lecture 13 Sections 5.8-5.9 Robb T. Koether Hampden-Sydney College Wed, Sep 26, 2018 Robb T. Koether (Hampden-Sydney College) while Loops Wed, Sep 26, 2018 1 / 25 1 while Loops 2 Input Loops
More informationProgramming Languages
Programming Languages Lecture 3 Robb T. Koether Hampden-Sydney College Fri, Aug 31, 2018 Robb T. Koether (Hampden-Sydney College) Programming Languages Fri, Aug 31, 2018 1 / 23 1 Programming Languages
More informationAmbient and Diffuse Light
Ambient and Diffuse Light Lecture 20 Robb T. Koether Hampden-Sydney College Mon, Oct 12, 2015 Robb T. Koether (Hampden-Sydney College) Ambient and Diffuse Light Mon, Oct 12, 2015 1 / 29 Outline 1 Lighting
More informationProgramming Languages
Programming Languages Lecture 3 Section 1.3 Robb T. Koether Hampden-Sydney College Mon, Sep 2, 2013 Robb T. Koether (Hampden-Sydney College) Programming Languages Mon, Sep 2, 2013 1 / 25 1 Programming
More informationThe Plurality-with-Elimination Method
The Plurality-with-Elimination Method Lecture 9 Section 1.4 Robb T. Koether Hampden-Sydney College Fri, Sep 8, 2017 Robb T. Koether (Hampden-Sydney College) The Plurality-with-Elimination Method Fri, Sep
More informationThe Traveling Salesman Problem Nearest-Neighbor Algorithm
The Traveling Salesman Problem Nearest-Neighbor Algorithm Lecture 31 Sections 6.4 Robb T. Koether Hampden-Sydney College Fri, Apr 6, 2018 Robb T. Koether (Hampden-Sydney College)The Traveling Salesman
More informationToday s Agenda. Shaders fundamentals. Programming with shader-based OpenGL
Today s Agenda Shaders fundamentals Programming with shader-based OpenGL Shaders Like a function call data are passed in, processed, and passed back out -- Shreiner et al, OpenGL Programming Guide GLSL
More informationSampling Distribution Examples Sections 15.4, 15.5
Sampling Distribution Examples Sections 15.4, 15.5 Lecture 27 Robb T. Koether Hampden-Sydney College Wed, Mar 2, 2016 Robb T. Koether (Hampden-Sydney College)Sampling Distribution ExamplesSections 15.4,
More informationCS 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 informationMipmaps. Lecture 35. Robb T. Koether. Hampden-Sydney College. Wed, Nov 18, 2015
Mipmaps Lecture 35 Robb T. Koether Hampden-Sydney College Wed, Nov 18, 2015 Robb T. Koether (Hampden-Sydney College) Mipmaps Wed, Nov 18, 2015 1 / 31 Outline 1 Discrete Sampling 2 Mipmaps 3 Generating
More informationRecursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 26, 2014
Recursive Sequences Lecture 24 Section 5.6 Robb T. Koether Hampden-Sydney College Wed, Feb 26, 2014 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 26, 2014 1 / 26 1 Recursive Sequences
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 16 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Mon, Oct 7, 2013 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Mon, Oct 7,
More informationBoxplots. Lecture 17 Section Robb T. Koether. Hampden-Sydney College. Wed, Feb 10, 2010
Boxplots Lecture 17 Section 5.3.3 Robb T. Koether Hampden-Sydney College Wed, Feb 10, 2010 Robb T. Koether (Hampden-Sydney College) Boxplots Wed, Feb 10, 2010 1 / 34 Outline 1 Boxplots TI-83 Boxplots 2
More informationLR Parsing - Conflicts
LR Parsing - Conflicts Lecture 15 Sections 4.5, 4.6 Robb T. Koether Hampden-Sydney College Fri, Feb 20, 2015 Robb T. Koether (Hampden-Sydney College) LR Parsing - Conflicts Fri, Feb 20, 2015 1 / 15 1 Shift/Reduce
More informationScheduling and Digraphs
Scheduling and Digraphs Lecture 35 Sections 8.1, 8.2 Robb T. Koether Hampden-Sydney College Mon, Nov 21, 2016 Robb T. Koether (Hampden-Sydney College) Scheduling and Digraphs Mon, Nov 21, 2016 1 / 25 1
More informationShaders. Slide credit to Prof. Zwicker
Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?
More informationPointers. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Fri, Jan 18, 2013
Pointers Lecture 2 Sections 10.3-10.8 Robb T. Koether Hampden-Sydney College Fri, Jan 18, 2013 Robb T. Koether (Hampden-Sydney College) Pointers Fri, Jan 18, 2013 1 / 35 1 Introduction 2 Pointer Arithmetic
More informationFriends and Unary Operators
Friends and Unary Operators Lecture 11 Sections 11.3, 11.6 Robb T. Koether Hampden-Sydney College Fri, Feb 13, 2015 Robb T. Koether (Hampden-Sydney College) Friends and Unary Operators Fri, Feb 13, 2015
More informationPointers. Lecture 1 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 14, 2015
Pointers Lecture 1 Sections 10.1-10.2 Robb T. Koether Hampden-Sydney College Wed, Jan 14, 2015 Robb T. Koether (Hampden-Sydney College) Pointers Wed, Jan 14, 2015 1 / 23 1 Pointers 2 Pointer Initialization
More informationThe Normal Distribution
The Normal Distribution Lecture 20 Section 6.3.1 Robb T. Koether Hampden-Sydney College Wed, Sep 28, 2011 Robb T. Koether (Hampden-Sydney College) The Normal Distribution Wed, Sep 28, 2011 1 / 41 Outline
More informationTotal Orders. Lecture 41 Section 8.5. Robb T. Koether. Hampden-Sydney College. Mon, Apr 8, 2013
Total Orders Lecture 41 Section 8.5 Robb T. Koether Hampden-Sydney College Mon, Apr 8, 2013 Robb T. Koether (Hampden-Sydney College) Total Orders Mon, Apr 8, 2013 1 / 30 1 Total Orders 2 Topological Sorting
More informationRecursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 27, 2013
Recursive Sequences Lecture 24 Section 5.6 Robb T. Koether Hampden-Sydney College Wed, Feb 27, 2013 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 27, 2013 1 / 21 1 Recursive Sequences
More informationRotations and Translations
Rotations and Translations Lecture 33 Sections 11.3-11.4 Robb T. Koether Hampden-Sydney College Wed, Nov 20, 2013 Robb T. Koether (Hampden-Sydney College) Rotations and Translations Wed, Nov 20, 2013 1
More informationRecursive Linked Lists
Recursive Linked Lists Lecture 28 Sections 14.1-14.5, 14.7 Robb T. Koether Hampden-Sydney College Fri, Mar 31, 2017 Robb T. Koether (Hampden-Sydney College) Recursive Linked Lists Fri, Mar 31, 2017 1 /
More informationThe string Class. Lecture 21 Sections 2.9, 3.9, Robb T. Koether. Wed, Oct 17, Hampden-Sydney College
The string Class Lecture 21 Sections 2.9, 3.9, 3.10 Robb T. Koether Hampden-Sydney College Wed, Oct 17, 2018 Robb T. Koether (Hampden-Sydney College) The string Class Wed, Oct 17, 2018 1 / 18 1 The String
More informationPointer Arithmetic. Lecture 4 Chapter 10. Robb T. Koether. Hampden-Sydney College. Wed, Jan 25, 2017
Pointer Arithmetic Lecture 4 Chapter 10 Robb T. Koether Hampden-Sydney College Wed, Jan 25, 2017 Robb T. Koether (Hampden-Sydney College) Pointer Arithmetic Wed, Jan 25, 2017 1 / 36 1 Pointer Arithmetic
More informationCS559 Computer Graphics Fall 2015
CS559 Computer Graphics Fall 2015 Practice Midterm Exam Time: 2 hrs 1. [XX Y Y % = ZZ%] MULTIPLE CHOICE SECTION. Circle or underline the correct answer (or answers). You do not need to provide a justification
More informationRecognition of Tokens
Recognition of Tokens Lecture 3 Section 3.4 Robb T. Koether Hampden-Sydney College Mon, Jan 19, 2015 Robb T. Koether (Hampden-Sydney College) Recognition of Tokens Mon, Jan 19, 2015 1 / 21 1 A Class of
More informationProgramming 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 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex
More informationCopyright 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 informationLecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009
Lecture 6 Sections 4.3, 4.6, 4.7 Hampden-Sydney College Wed, Sep 9, 2009 Outline 1 2 3 4 re are three mutually orthogonal axes: the x-axis, the y-axis, and the z-axis. In the standard viewing position,
More informationCSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:
More informationThe Mesh Class. Lecture 26. Robb T. Koether. Wed, Oct 28, Hampden-Sydney College
The Mesh Class Lecture 26 Robb T. Koether Hampden-Sydney College Wed, Oct 28, 2015 Robb T. Koether (Hampden-Sydney College) The Mesh Class Wed, Oct 28, 2015 1 / 23 Outline 1 The Mesh Class 2 Assignment
More informationCSE 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 informationLecture 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 informationStreet-Routing Problems
Street-Routing Problems Lecture 26 Sections 5.1-5.2 Robb T. Koether Hampden-Sydney College Wed, Oct 25, 2017 Robb T. Koether (Hampden-Sydney College) Street-Routing Problems Wed, Oct 25, 2017 1 / 21 1
More informationLecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009
Model s Lecture 3 Sections 2.2, 4.4 World s Eye s Clip s s s Window s Hampden-Sydney College Mon, Aug 31, 2009 Outline Model s World s Eye s Clip s s s Window s 1 2 3 Model s World s Eye s Clip s s s Window
More informationProgramming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 Objectives Simple Shaders - Vertex shader - Fragment shaders Programming shaders with
More informationImplementing Linked Lists
Implementing Linked Lists Lecture 16 Sections 17.1-17.3 Robb T. Koether Hampden-Sydney College Wed, Feb 27, 2013 Robb T. Koether (Hampden-Sydney College) Implementing Linked Lists Wed, Feb 27, 2013 1 /
More informationThe Decreasing-Time Algorithm
The Decreasing-Time Algorithm Lecture 36 Sections 8.4 Robb T. Koether Hampden-Sydney College Wed, Apr 18, 2018 Robb T. Koether (Hampden-Sydney College) The Decreasing-Time Algorithm Wed, Apr 18, 2018 1
More informationLab 2-3D Transformations and Vertex Shaders
Lab 2-3D Transformations and Vertex Shaders Support code: /course/cs1230/src/labs/lab02 Demo: /course/cs1230/bin/cs1230_lab02_demo Intro Last week you learned how to draw 2D shapes in OpenGL using VBOs
More informationSUMMARY. CS380: Introduction to Computer Graphics Projection Chapter 10. Min H. Kim KAIST School of Computing 18/04/12. Smooth Interpolation
CS38: Introduction to Computer Graphics Projection Chapter Min H. Kim KAIST School of Computing Smooth Interpolation SUMMARY 2 Cubic Bezier Spline To evaluate the function c(t) at any value of t, we perform
More informationProgramming 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 informationThe Coefficient of Determination
The Coefficient of Determination Lecture 46 Section 13.9 Robb T. Koether Hampden-Sydney College Wed, Apr 17, 2012 Robb T. Koether (Hampden-Sydney College) The Coefficient of Determination Wed, Apr 17,
More informationBuilding Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Building Models CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce simple data structures for building polygonal models - Vertex lists - Edge
More informationComputaçã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 informationComputer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL
More informationStack Applications. Lecture 27 Sections Robb T. Koether. Hampden-Sydney College. Wed, Mar 29, 2017
Stack Applications Lecture 27 Sections 18.7-18.8 Robb T. Koether Hampden-Sydney College Wed, Mar 29, 2017 Robb T. Koether Hampden-Sydney College) Stack Applications Wed, Mar 29, 2017 1 / 27 1 Function
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 4 3D Viewing Matt Burlick - Drexel University - CS 432 1 Reading Angel Chapters 3-4 Red Book Chapter 5, Appendix E Matt Burlick - Drexel University - CS 432
More informationDisplaying Distributions - Quantitative Variables
Displaying Distributions - Quantitative Variables Lecture 13 Sections 4.4.1-4.4.3 Robb T. Koether Hampden-Sydney College Wed, Feb 8, 2012 Robb T. Koether (Hampden-Sydney College)Displaying Distributions
More informationINFOGR Computer Graphics
INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2017 Lecture 10: Shaders Welcome! INFOGR2016/17 Today s Agenda: Recap: Diffuse Materials The Phong Shading Model Environment
More informationComputer Graphics 7: Viewing in 3-D
Computer Graphics 7: Viewing in 3-D In today s lecture we are going to have a look at: Transformations in 3-D How do transformations in 3-D work? Contents 3-D homogeneous coordinates and matrix based transformations
More informationPointers. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Mon, Jan 20, 2014
Pointers Lecture 2 Sections 10.3-10.8 Robb T. Koether Hampden-Sydney College Mon, Jan 20, 2014 Robb T. Koether (Hampden-Sydney College) Pointers Mon, Jan 20, 2014 1 / 35 1 Endianness 2 Pointer Arithmetic
More informationOperators. Lecture 12 Section Robb T. Koether. Hampden-Sydney College. Fri, Feb 9, 2018
Operators Lecture 12 Section 14.5 Robb T. Koether Hampden-Sydney College Fri, Feb 9, 2018 Robb T. Koether (Hampden-Sydney College) Operators Fri, Feb 9, 2018 1 / 21 Outline 1 Operators as Functions 2 Operator
More informationDynamic Allocation of Memory
Dynamic Allocation of Memory Lecture 4 Sections 10.9-10.10 Robb T. Koether Hampden-Sydney College Fri, Jan 25, 2013 Robb T. Koether (Hampden-Sydney College) Dynamic Allocation of Memory Fri, Jan 25, 2013
More informationMipmaps. Lecture 23 Subsection Fri, Oct 30, Hampden-Sydney College. Mipmaps. Robb T. Koether. Discrete Sampling.
Lecture 23 Subsection 8.8.2 Hampden-Sydney College Fri, Oct 30, 2009 Outline 1 2 3 4 5 dumay.info Outline 1 2 3 4 5 dumay.info Suppose we are drawing a 2-dimensional black-and-white checkerboard pattern.
More informationBinary Tree Applications
Binary Tree Applications Lecture 30 Section 19.2 Robb T. Koether Hampden-Sydney College Wed, Apr 15, 2015 Robb T. Koether (Hampden-Sydney College) Binary Tree Applications Wed, Apr 15, 2015 1 / 56 1 Binary
More informationBoolean Expressions. Lecture 31 Sections 6.6, 6.7. Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015
Boolean Expressions Lecture 31 Sections 6.6, 6.7 Robb T. Koether Hampden-Sydney College Wed, Apr 8, 2015 Robb T. Koether (Hampden-Sydney College) Boolean Expressions Wed, Apr 8, 2015 1 / 22 1 Relational
More information2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into
2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel
More informationList Iterator Implementation
List Iterator Implementation Lecture 28 Section 14.6 Robb T. Koether Hampden-Sydney College Fri, Apr 10, 2015 Robb T. Koether (Hampden-Sydney College) List Iterator Implementation Fri, Apr 10, 2015 1 /
More informationOPENGL 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 informationLR Parsing - The Items
LR Parsing - The Items Lecture 10 Sections 4.5, 4.7 Robb T. Koether Hampden-Sydney College Fri, Feb 13, 2015 Robb T. Koether (Hampden-Sydney College) LR Parsing - The Items Fri, Feb 13, 2015 1 / 31 1 LR
More informationComputer Graphics Coursework 1
Computer Graphics Coursework 1 Deadline Deadline: 4pm, 24/10/2016 4pm 23/10/2015 Outline The aim of the coursework is to modify the vertex and fragment shaders in the provided OpenGL framework to implement
More informationCSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Project 2 due Friday, October 12
More informationLecture 9 Sections 2.6, 5.1, 5.2. Wed, Sep 16, 2009
Lecture 9 Sections 2.6, 5.1, 5.2 Hampden-Sydney College Wed, Sep 16, 2009 Outline 1 2 3 4 5 6 Controlling 7 Definition () A frustum is a truncated pyramid. Definition ( ) The view frustum is the region
More informationStacks and their Applications
Stacks and their Applications Lecture 23 Sections 18.1-18.2 Robb T. Koether Hampden-Sydney College Fri, Mar 16, 2018 Robb T. Koether Hampden-Sydney College) Stacks and their Applications Fri, Mar 16, 2018
More informationBasic PHP Lecture 17
Basic PHP Lecture 17 Robb T. Koether Hampden-Sydney College Fri, Feb 24, 2012 Robb T. Koether (Hampden-Sydney College) Basic PHPLecture 17 Fri, Feb 24, 2012 1 / 30 1 PHP 2 Basic PHP 3 The Extended echo
More informationCS4621/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 informationINFOGR Computer Graphics
INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2018 Lecture 10: Shaders Welcome! Ƹ Ƹ Ƹ x M final = T totorso R T down R = x y z 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Operations: 1. Translate
More informationArray Lists. Lecture 15. Robb T. Koether. Hampden-Sydney College. Fri, Feb 16, 2018
Array Lists Lecture 15 Robb T. Koether Hampden-Sydney College Fri, Feb 16, 2018 Robb T. Koether (Hampden-Sydney College) Array Lists Fri, Feb 16, 2018 1 / 21 1 Inlining Functions 2 List Implementations
More informationFundamental Data Types
Fundamental Data Types Lecture 4 Sections 2.7-2.10 Robb T. Koether Hampden-Sydney College Mon, Sep 3, 2018 Robb T. Koether (Hampden-Sydney College) Fundamental Data Types Mon, Sep 3, 2018 1 / 25 1 Integers
More informationComputer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York
Computer Viewing Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing
More informationThe Class Construct Part 2
The Class Construct Part 2 Lecture 24 Sections 7.7-7.9 Robb T. Koether Hampden-Sydney College Mon, Oct 29, 2018 Robb T. Koether (Hampden-Sydney College) The Class Construct Part 2 Mon, Oct 29, 2018 1 /
More informationRecursive Descent Parsers
Recursive Descent Parsers Lecture 7 Robb T. Koether Hampden-Sydney College Wed, Jan 28, 2015 Robb T. Koether (Hampden-Sydney College) Recursive Descent Parsers Wed, Jan 28, 2015 1 / 18 1 Parsing 2 LL Parsers
More informationAdvanced Lighting Techniques Due: Monday November 2 at 10pm
CMSC 23700 Autumn 2015 Introduction to Computer Graphics Project 3 October 20, 2015 Advanced Lighting Techniques Due: Monday November 2 at 10pm 1 Introduction This assignment is the third and final part
More informationXPath. Lecture 36. Robb T. Koether. Wed, Apr 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, / 28
XPath Lecture 36 Robb T. Koether Hampden-Sydney College Wed, Apr 16, 2014 Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, 2014 1 / 28 1 XPath 2 Executing XPath Expressions 3 XPath Expressions
More information