Computer graphics MN1
|
|
- Anissa Shepherd
- 6 years ago
- Views:
Transcription
1 Computer graphics MN1 Hierarchical modeling Transformations in OpenGL glmatrixmode(gl_modelview); glloadidentity(); // identity matrix gltranslatef(4.0, 5.0, 6.0); glrotatef(45.0, 1.0, 2.0, 3.0); gltranslatef(-4.0, -5.0, -6.0); C=T(4.0,5.0,6.0) R(45,1.0,2.0,3.0) T(-4.0,-5.0,-6.0) q=cp The transformation specified last is the one applied first OpenGL matrix stacks The matrix stacks can be used for implementing hierarchical transforms A copy of the current matrix is pushed onto the stack by using glpushmatrix() It is fetched again by using glpopmatrix() The current matrix is the one on top of the stack 32 4x4 matrices (GL_MODELVIEW) OpenGL matrix stacks OpenGL matrix stacks glpushmatrix() duplicates the current matrix Remember where you are OpenGL matrix stacks glpopmatrix() deletes the current matrix Go back to where you were 1
2 Example void initglut( int &argc, char **argv) { glutinit( &argc,argv ); // Get two frame buffers with GLUT_DOUBLE glutinitdisplaymode( GLUT_DOUBLE GLUT_RGB GLUT_DEPTH ); glutinitwindowsize( 512, 512 ); glutinitwindowposition( 100, 100 ); glutcreatewindow( TITLE ); void initgl() { glclearcolor( 0.0, 0.0, 0.0, 0.0 ); glmatrixmode( GL_PROJECTION ); glloadidentity(); gluperspective(65.0, 1.0, 1.0, 20.0 ); glmatrixmode (GL_MODELVIEW ); glloadidentity(); glulookat(1,-4,-4,0,0,0,0,1,0); glenable(gl_depth_test); glshademodel( GL_SMOOTH ); void polygon(int a, int b, int c, int d) { glbegin(gl_polygon); glcolor3fv(colors[a]); glnormal3fv(normals[a]); glvertex3fv(vertices[a]);... glend(); void draw() { glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); void colorcube(void) { // Draw the different sides. polygon(0,3,2,1); polygon(2,3,7,6); polygon(0,4,7,3); polygon(1,2,6,5); polygon(4,5,6,7); polygon(0,1,5,4); // push the current transform matrix glrotatef(theta[0],1,0,0); glrotatef(theta[1],0,1,0); glrotatef(theta[2],0,0,1); colorcube(); // draw the cube // pop the matrix from the stack // push the matrix onto the stack gltranslatef(2,1,0); glrotatef(45,1,0,1); glscalef(0.2,0.5,0.5); colorcube(); // draw the small block // pop the matrix from the stack glflush(); glutswapbuffers(); 2
3 void animate() { theta[axis] +=2.0; if(theta[axis]>360.0) theta[axis]-=360.0; glutpostredisplay(); void mouse(int btn, int state, int x, int y) { if(btn==glut_left_button && state==glut_down) axis = 0; if(btn==glut_middle_button && state==glut_down) axis = 1; if(btn==glut_right_button && state==glut_down) axis = 2; int main(int argc, char **argv) { initglut(argc, argv); initgl(); // Set the callback functions. glutdisplayfunc( draw ); glutidlefunc( animate ); glutmousefunc( mouse ); //Start the GLUT main Loop. glutmainloop(); return 0; Symbols and instances A collection of simple objects such as spheres, cubes,, cylinders, Compose complex objects from these primitives Regard primitives as symbols and each realization as an instance Location, orientation,, and size: instance transform Symbols and instances A table data structure allows us to transform objects and to add/delete objects Hierarchical modeling Hierarchical modeling A table is not a hierarchical data structure Want a structure that shows relationships among the components Consider a model of a car: The weels are identical except from position and orientation We would like to couple wheel motion and chassis motion, not use separate translations 3
4 Hirarchical modeling A tree data structure for the car model shows the relationship between components A robot Three coordinate systems Drawing arms with glutsolidcube() M=TRS Drawing base with glucylinder() Transforms M=TRS uah Translatef(0,bh+lah,0); lah Translatef(0,bh,0); bh 4
5 Transforms Ry(θ) T(bh) Rz(α) T(lah) Rz(β) Ry(θ) T(bh) Rz(α) Ry(θ) #ifdef WIN32 #include <windows.h> #endif #include <cstdlib> #include <GL/glut.h> using namespace std; #define BASE_HEIGHT 4.0 #define BASE_RADIUS 2.0 #define LOWER_ARM_HEIGHT 4.0 #define LOWER_ARM_WIDTH 1.0 #define UPPER_ARM_HEIGHT 4.0 #define UPPER_ARM_WIDTH 1.0 void base() { glcolor3f(.7,0.0,0.0); // cylinder aligned with z axis as default // rotate cylinder to align with y axis glrotatef(-90.0, 1.0, 0.0, 0.0); glucylinder(p, BASE_RADIUS, BASE_RADIUS, BASE_HEIGHT, 20, 5); void upper_arm() { glcolor3f(0.0,.7,0.0); gltranslatef(0.0, 0.5*UPPER_ARM_HEIGHT, 0.0); glscalef(upper_arm_width, UPPER_ARM_HEIGHT, UPPER_ARM_WIDTH); glutsolidcube(1.0); void lower_arm() { glcolor3f(0.0,0.0,.7); gltranslatef(0.0, 0.5*LOWER_ARM_HEIGHT, 0.0); glscalef(lower_arm_width, LOWER_ARM_HEIGHT, LOWER_ARM_WIDTH); glutsolidcube(1.0); void display(void) { glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glloadidentity(); // this rotation applies to all three parts of the robot glrotatef(theta[0], 0.0, 1.0, 0.0); base(); // this only applies to the upper and lower arm gltranslatef(0.0, BASE_HEIGHT, 0.0); glrotatef(theta[1], 0.0, 0.0, 1.0); lower_arm(); // this only applies to the upper arm gltranslatef(0.0, LOWER_ARM_HEIGHT, 0.0); glrotatef(theta[2], 0.0, 0.0, 1.0); upper_arm(); glflush(); glutswapbuffers(); 5
6 void mouse(int btn, int state, int x, int y) { // left button increase joint angle, // right button decreases it if(btn==glut_left_button && state == GLUT_DOWN){ theta[axis] += 5.0; if( theta[axis] > ) theta[axis] -= 360.0; if(btn==glut_right_button && state == GLUT_DOWN){ theta[axis] -= 5.0; if( theta[axis] < ) theta[axis] += 360.0; display(); // menu callback void menu(int id) { // menu selects which angle to change or whether to // quit if(id == 1 ) axis=0; if(id == 2 ) axis=1; if(id == 3 ) axis=2; if(id == 4 ) exit(0); Result int main(int argc, char **argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH); glutinitwindowsize(500, 500); glutcreatewindow("robot"); // initialize (lights) myinit(); // menu glutaddmenuentry("base", 1); glutaddmenuentry("lower arm", 2); glutaddmenuentry("upper arm", 3); glutaddmenuentry("quit", 4); glutattachmenu( GLUT_MIDDLE_BUTTON); // start the loop glutmainloop(); return 0; Tree data structures Tree data structures A tree is a type of graph that consists of nodes and edges All nodes except the root node have a parent node and a number of child nodes A node without children is called a leaf node If we store necessary information in the nodes we need at least three components A (pointer to) function that draws the object A matrix that transforms the node and its children relative to its parent Pointers to children We can also store information about, e.g.,., color and material properties 6
7 Tree traversal To draw the whole object we need to visit all nodes, compute the correct matrix, and display the primitives Tree data structures A recursive pre-order traversal can be implemented using OpenGL s matrix stack Tree data structures We do not want to create a new function for each model The data structure should be model independent Object-oriented modeling A tree structure can be implemented in a natural way by using object-oriented oriented programming We can define a base-class node and derive other classes by inheritance Object-oriented modeling class node { node(); virtual ~node(); virtual void render(); void addchild(node *n); node *children; ; class geometry : public node { geometry(); ~geometry(); virtual void render(); void setcolor(color c); void setmaterial(material m); ; class sphere : public geometry { float radius; sphere(float r=1.0); void render(); ; class transform : public node { matrix M; transform(matrix m); void render(); ; Scene graphs A general data structure to represent a whole scene We can have nodes for geometrical objects,, transforms, cameras, lights,, Each node can contain attributes such as color,, material, render mode, Here we can use OpenGL s attribute stack ( glpushattrib(), glpopattrib() ) 7
8 Scene graphs Simple scene graph API in the textbook (Angel) which can be downloaded from the web OpenInventor is a object-oriented oriented scene graph based toolkit built on top of OpenGL oss.sgi.com/projects/inventor/ VRML (X3D) is a general scene graph language used to facilitate 3D graphics on the web Assignment 4 Assignment 4 In the previous assignments you wrote your own algorithms, now it's time to get some feeling for a widely used API. In this assignment you should: Implement hierarchical transforms with animation in an OpenGL environment. Increase realism with the help of texture mapping,, material properties,, and lighting. Implement a simple mouse interface. Be creative! Assignment 4 On the course webpage there is a small C++ code package that you can use.. It is not a scene graph package. OpenGL functions are wrapped in C++ classes Ex.: Lightsource,, Camera, Geometry,, The code package is not complete in any sense. You are encouraged to extend it with your ideas. If you rather write your own code, feel free to do that. Lightsource.hh (sample) class Lightsource { protected: GLenum gl_light; Color ambient; Color diffuse; Color specular; Vector3h position; Vector3 direction; float exponent; float cutoff; float constant_attenuation; float linear_attenuation; float quadratic_attenuation; void setambient(const Color &col) { ambient = col; gllightfv(gl_light, GL_AMBIENT, ambient.data); Geometry.hh (sample) class Geometry { protected: Material material; unsigned int texture; Geometry() : texture(0) { virtual ~Geometry() { virtual void setmaterial(const Material &mat) { material = mat; virtual void settexture(unsigned int tex) { texture = tex; // This function does the real rendering, // i.e., vertices, normals, and polygons. // Should be implemented in derived classes virtual void makegl() = 0; 8
9 Geometry.hh (sample) // here we set the material properties and bind the texture virtual void render() { // push attributes on the attribute stack glpushattrib(gl_all_attrib_bits); // bind the texture glbindtexture(gl_texture_2d, this->texture); // set material properties glmaterialfv(gl_front_and_back, GL_AMBIENT, this->material.ambient.data); glmaterialfv(gl_front_and_back, GL_DIFFUSE, this->material.diffuse.data); // the actual rendering makegl(); // pop attributes glpopattrib(); Plane.hh (sample) // a plane, drawn in the xy plane class Plane : public Geometry { Plane(float _width, float _height) : width(_width), height(_height) { virtual ~Plane() { virtual void makegl() { glscalef(width,height,1); glbegin(gl_quads); gltexcoord2f(0,0); glnormal3f(0,0,1); glvertex3f(-.5,.5, 0.0); gltexcoord2f(1,0); glnormal3f(0,0,1); glvertex3f(.5,.5, 0.0); gltexcoord2f(1,1); glnormal3f(0,0,1); glvertex3f(.5,-.5, 0.0); gltexcoord2f(0,1); glnormal3f(0,0,1); glvertex3f(-.5,-.5, 0.0); glend(); planets.cpp (sample) // lights (in init function) light1 = new Lightsource(GL_LIGHT1); light1 -> setposition(vector3h(-500.0, 500.0, 500.0, 1.0)); // space (in init function) space = new Plane(500, 250); space -> settexture(loadgltextures("textures/stars.bmp")); // draw space (in display function) gltranslatef(0,0,-400); space->render(); 9
Computer graphics MN1
Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code
More informationModeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益
Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene
More informationOrder of Transformations
Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note
More informationHierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,
Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling Hofstra University 1 Modeling complex objects/motion Decompose object hierarchically
More informationCSC 470 Computer Graphics
CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using
More informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More information// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations
#include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering
More informationComputer graphics MN1
Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? HowdoI useit? Rendering pipeline Points, vertices, lines, polygons Matrices and transformations Lighting and shading Code examples
More informationBooks, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D
Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives
More informationC OMPUTER G RAPHICS Thursday
C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics
More informationComputer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations
Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations
More informationOpenGL for dummies hello.c #include int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (250, 250); glutinitwindowposition
More informationInteraction Computer Graphics I Lecture 3
15-462 Computer Graphics I Lecture 3 Interaction Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations January 21, 2003 [Angel Ch. 3] Frank Pfenning Carnegie Mellon
More informationBooks, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt
Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer
More informationInteraction. CSCI 480 Computer Graphics Lecture 3
CSCI 480 Computer Graphics Lecture 3 Interaction January 18, 2012 Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations
More informationIntroduction to OpenGL
Introduction to OpenGL Tutorial 1: Create a window and draw a 2D square Introduction: The aim of the first tutorial is to introduce you to the magic world of graphics based on the OpenGL and GLUT APIs.
More informationCS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008
CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation
More informationUNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M
UNIT 7 LIGHTING AND SHADING 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M Ans: Phong developed a simple model that can be computed rapidly It considers three
More informationOpenGL/GLUT Intro. Week 1, Fri Jan 12
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:
More informationGL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW
OpenGL Syntax Functions have prefix gl and initial capital letters for each word glclearcolor(), glenable(), glpushmatrix() glu for GLU functions glulookat(), gluperspective() constants begin with GL_,
More informationCS D Transformation. Junqiao Zhao 赵君峤
CS10101001 3D Transformation Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Review Translation Linear transformation
More information1 /* 4 C:\opencv\build\include. 6 C:\opencv\build\x86\vc10\lib
1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib
More informationAPI for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3
OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,
More informationLecture 4 of 41. Lab 1a: OpenGL Basics
Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor
More informationComputer Graphics. OpenGL
Computer Graphics OpenGL What is OpenGL? OpenGL (Open Graphics Library) is a library for computer graphics It consists of several procedures and functions that allow a programmer to specify the objects
More informationTo Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)
Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics
More informationProgramming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall
Programming with OpenGL Part 2: Complete Programs 91.427 Computer Graphics I, Fall 2008 1 1 Objectives Refine first program Alter default values Introduce standard program structure Simple viewing 2-D
More informationIntroduction to Computer Graphics with OpenGL/GLUT
Introduction to Computer Graphics with OpenGL/GLUT What is OpenGL? A software interface to graphics hardware Graphics rendering API (Low Level) High-quality color images composed of geometric and image
More information2 Transformations and Homogeneous Coordinates
Brief solutions to Exam in Computer Graphics Time and place: 08:00 3:00 Tuesday March 7, 2009, Gimogatan 4, sal Grades TD388: 3: 20pts; 4: 26pts; 5: 34pts. Glossary API Application Programmer s Interface.
More informationC++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson
C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson Syllabus 1) First program and introduction to data types and control structures with applications for games learning how to use the programming
More information20 GLuint objects; 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN:
1 1. 1 #include 2 #include 3 Program 1 (OpenGL Sample016) 4 // 5 static int MouseX = 0; // X 6 static int MouseY = 0; // Y 7 static float SpinX = 0; // X 8 static float SpinY = 0;
More informationLecture 2 CISC440/640 Spring Department of Computer and Information Science
Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1
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 informationModeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)
Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the volume Each surface patch is approximated set of polygons Each polygon is specified
More informationProgramming with OpenGL Part 3: Three Dimensions
Programming with OpenGL Part 3: Three Dimensions Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Develop a more sophisticated
More informationModeling Objects. Modeling. Symbol-Instance Table. Instance Transformation. Each appearance of the object in the model is an instance
Modeling Objects Modeling Hierarchical Transformations Hierarchical Models Scene Graphs A prototype has a default size, position, and orientation You need to perform modeling transformations to position
More informationHierarchical Modeling. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell
Hierarchical Modeling University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Reading Angel, sections 9.1-9.6 [reader pp. 169-185] OpenGL Programming Guide, chapter 3 Focus especially
More informationIntroduction to OpenGL
Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html
More informationLecture 2 2D transformations Introduction to OpenGL
Lecture 2 2D transformations Introduction to OpenGL OpenGL where it fits what it contains how you work with it OpenGL parts: GL = Graphics Library (core lib) GLU = GL Utilities (always present) GLX, AGL,
More informationHierarchical Modeling
Hierarchical Modeling Geometric Primitives Remember that most graphics APIs have only a few geometric primitives Spheres, cubes, triangles, etc These primitives are instanced in order to apply transforms
More informationCOMPUTER GRAPHICS LAB # 3
COMPUTER GRAPHICS LAB # 3 Chapter 2: COMPUTER GRAPHICS by F.S HILLs. Initial steps in drawing figures (polygon, rectangle etc) Objective: Basic understanding of simple code in OpenGL and initial steps
More informationBasic Graphics Programming
15-462 Computer Graphics I Lecture 2 Basic Graphics Programming Graphics Pipeline OpenGL API Primitives: Lines, Polygons Attributes: Color Example January 17, 2002 [Angel Ch. 2] Frank Pfenning Carnegie
More informationOutline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process
Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting GLUT Resources Some images in these slides
More informationGraphics and Computation Introduction to OpenGL
433-380 Graphics and Computation Introduction to OpenGL Some images in these slides are taken from The OpenGL Programming Manual, which is copyright Addison Wesley and the OpenGL Architecture Review Board.
More informationHierarchical Modeling and Scene Graphs
Hierarchical Modeling and Scene Graphs Adapted from material prepared by Ed Angel Spring 2009 Objectives Examine the limitations of linear modeling Symbols and instances Introduce hierarchical models Articulated
More informationCS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008
CS559: Computer Graphics Lecture 2: OpenGL Transformation Li Zhang Spring 28 Today Transformation in OpenGL Reading Chapter 3 Last time Primitive Details glpolygonmode(glenum face, GLenum mode); face:
More informationLecture 3. Understanding of OPenGL programming
Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.
More informationCameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field
Cameras (and eye) Ideal Pinhole Real Pinhole Real + lens Depth of field 1 Z-buffer How do we draw objects? Polygon Based Fast Raytracing Ray/Object intersections Slow Copyright Pixar 2 Raytracing for each
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 informationHierarchical Modeling and Scene Graphs
Hierarchical Modeling and Scene Graphs Adapted from material prepared by Ed Angel Spring 2009 Objectives Examine the limitations of linear modeling Symbols and instances Introduce hierarchical models Articulated
More informationBasic Graphics Programming
CSCI 480 Computer Graphics Lecture 2 Basic Graphics Programming January 11, 2012 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s12/ Graphics Pipeline OpenGL API
More informationComputer Graphics. Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationUsing OpenGL with CUDA
Using OpenGL with CUDA Installing OpenGL and GLUT; compiling with nvcc Basics of OpenGL and GLUT in C Interoperability between OpenGL and CUDA OpenGL = Open Graphic Library creation of 3D graphic primitives
More informationProgramming using OpenGL: A first Introduction
Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics OpenGL Basics Yong Cao Virginia Tech References: 2001 Siggraph, An Interactive Introduction to OpenGL Programming, Dave Shreiner,Ed Angel, Vicki Shreiner Official Presentation
More informationInput and Interaction. 1. Interaction. Chapter 3. Introduction: - We now turn to the development of interactive graphics programs.
Input and Interaction Chapter 3 Introduction: - We now turn to the development of interactive graphics programs. - Our discussion has three main parts First, we consider the variety of devices available
More information11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)
CSCI 420 Computer Graphics Lecture 2 Basic Graphics Programming Teaching Assistant Yijing Li Office hours TBA Jernej Barbic University of Southern California Graphics Pipeline OpenGL API Primitives: Lines,
More informationComputer Graphics Introduction to OpenGL
Computer Graphics 2015 3. Introduction to OpenGL Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-09-28 2. 2D Graphics Algorithms (cont.) Rasterization Computer Graphics @ ZJU Hongxin Zhang,
More information2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California [Angel Ch. 2] Triangles (Clarification) Can be any shape or size Well-shaped triangles have advantages for
More informationLecture 5: Viewing. CSE Computer Graphics (Fall 2010)
Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping
More informationHierarchical Modelling
Gregor Miller gregor{at}ece.ubc.ca Hierarchical Modelling Limitations of linear modelling Articulated models Tree and DAG models Traversal Strategies Instance Transformation Start with a prototype object
More informationUsing GLU/GLUT Objects
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutwirecone glutwirecube glucylinder glutwireteapot GLU/GLUT Objects Each glu/glut object has its default size, position, and orientation
More informationInteraction. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations [Angel Ch.
More informationVR-programming tools (procedural) More VRML later in this course! (declarative)
Realtime 3D Computer Graphics & Virtual Reality OpenGL Introduction VR-programming Input and display devices are the main hardware interface to users Immersion embeds users through the generation of live-like
More informationOpenGL refresher. Advanced Computer Graphics 2012
Advanced Computer Graphics 2012 What you will see today Outline General OpenGL introduction Setting up: GLUT and GLEW Elementary rendering Transformations in OpenGL Texture mapping Programmable shading
More informationFAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4. C++ - OpenGL
FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM 3213 - INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4 C++ - OpenGL Part 1- C++ - Texture Mapping 1. Download texture file and put it into your current folder
More informationGraphics Programming
Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library
More informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller
More informationby modifying the glutinitwindowsize() function you can change the screen size to whatever you please.
Zoe Veale Lab 2 Draw2 part 1: I edited the glutinitwindowsize() function tom change the size of my screen window. int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode
More informationTransformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Transformations CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive
More informationRECITATION - 1. Ceng477 Fall
RECITATION - 1 Ceng477 Fall 2007-2008 2/ 53 Agenda General rules for the course General info on the libraries GLUT OpenGL GLUI Details about GLUT Functions Probably we will not cover this part 3/ 53 General
More informationHierarchical Modeling and scene graphs
Hierarchical Modeling and scene graphs Overview Examine the limitations of linear modeling Introduce hierarchical models Introduce Tree and DAG models Build a tree-structured model of a humanoid figure
More informationLectures OpenGL Introduction
Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is
More informationSOURCES AND URLS BIBLIOGRAPHY AND REFERENCES
In this article, we have focussed on introducing the basic features of the OpenGL API. At this point, armed with a handful of OpenGL functions, you should be able to write some serious applications. In
More informationERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL
ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO SANTA BARBARA SANTA CRUZ EECS 104 Fundamentals of Computer Graphics OpenGL Slides courtesy of Dave Shreine, Ed Angel and Vicki Shreiner
More informationTransformation, Input and Interaction. Hanyang University
Transformation, Input and Interaction Hanyang University Transformation, projection, viewing Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture 8 3 2008 Steve
More informationRendering Pipeline/ OpenGL
Chapter 2 Basics of Computer Graphics: Your tasks for the weekend Piazza Discussion Group: Register Post review questions by Mon noon Use private option, rev1 tag Start Assignment 1 Test programming environment
More informationIntroduction to OpenGL: Part 2
Introduction to OpenGL: Part 2 Introduction to OpenGL: Part 2 A more complex example recursive refinement Introduction to OpenGL: Part 2 A more complex example recursive refinement Can OpenGL draw continuous
More informationOpenGL Tutorial. Ceng 477 Introduction to Computer Graphics
OpenGL Tutorial Ceng 477 Introduction to Computer Graphics Adapted from: http://www.cs.princeton.edu/courses/archive/spr06/cos426/assn3/opengl_tutorial.ppt OpenGL IS an API OpenGL IS nothing more than
More informationObjectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations
Objectives Transformations CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive homogeneous
More informationGraphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++
Computer Graphics Graphics Programming August 31, 2005 Contents Our Goal in This Chapter Programming of the Sierpinski gasket How To? Programming with OpenGL and C/C++ OpenGL API (Application Programmer
More informationDisplay Lists in OpenGL
Display Lists in OpenGL Display lists are a mechanism for improving performance of interactive OpenGL applications. A display list is a group of OpenGL commands that have been stored for later execution.
More informationComputer Graphics. Transformations. CSC 470 Computer Graphics 1
Computer Graphics Transformations CSC 47 Computer Graphics 1 Today s Lecture Transformations How to: Rotate Scale and Translate 2 Introduction An important concept in computer graphics is Affine Transformations.
More informationDrawing Primitives. OpenGL basics
CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library
More informationChapter 13 Selection and Feedback
OpenGL Programming Guide (Addison-Wesley Publishing Company) Chapter 13 Selection and Feedback Chapter Objectives After reading this chapter, you ll be able to do the following: Create applications that
More informationTeacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using
Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in
More informationComputer Graphics Course 2005
Computer Graphics Course 2005 Introduction to GLUT, GLU and OpenGL Administrative Stuff Teaching Assistant: Rony Goldenthal Reception Hour: Wed. 18:00 19:00 Room 31 (Ross 1) Questions: E-mail: cg@cs Newsgroups:
More informationQUESTION 1 [10] 2 COS340-A October/November 2009
2 COS340-A QUESTION 1 [10] a) OpenGL uses z-buffering for hidden surface removal. Explain how the z-buffer algorithm works and give one advantage of using this method. (5) Answer: OpenGL uses a hidden-surface
More informationProgramming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Development of the OpenGL API
More informationDuc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1
Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1 1. The endpoints of a given line are (0, 0) and (18, 6). Compute the first 4 values of y manually using Bresenham's Line Algorithm as x steps
More informationAnnouncements OpenGL. Computer Graphics. Autumn 2009 CS4815
Computer Graphics Autumn 2009 Outline 1 Labs 2 Labs Outline 1 Labs 2 Labs Labs Week02 lab Marking 8 10 labs in total each lab worth 2 3% of overall grade marked on attendance and completion of lab completed
More informationIntroduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationComputer Graphics Primitive Attributes
Computer Graphics 2015 4. Primitive Attributes Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-10-12 Previous lessons - Rasterization - line - circle /ellipse? => homework - OpenGL and
More informationLecture 3 Advanced Computer Graphics (CS & SE )
Lecture 3 Advanced Computer Graphics (CS & SE 233.420) Programming with OpenGL Program Structure Primitives Attributes and States Programming in three dimensions Inputs and Interaction Working with Callbacks
More informationAnnouncements OpenGL. Computer Graphics. Spring CS4815
Computer Graphics Spring 2017-2018 Outline 1 2 Tutes and Labs Tute02, vector review (see matrix) Week02 lab Lab Marking 10 labs in total each lab worth 3% of overall grade marked on attendance and completion
More informationLecture 08: Hierarchical Modeling with Scene Graphs
Lecture 08: Hierarchical Modeling with Scene Graphs CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 2, 2010 Symbols and Instances Objects as Symbols Model world as a collection
More informationgvirtualxray Tutorial 01: Creating a Window and an OpenGL Context Using GLUT
gvirtualxray Tutorial 01: Creating a Window and an OpenGL Context Using GLUT Dr Franck P. Vidal 4 th September 2014 1 Contents Table of contents 2 List of figures 3 List of listings 3 1 Introduction 4
More informationOpenGL and X, Column 1: An OpenGL Toolkit
Copyright c 1994 Mark J. Kilgard. All rights reserved. PUBLISHED IN THE NOVEMBER/DECEMBER 1994 ISSUE OF The X Journal. OpenGL and X, Column 1: An OpenGL Toolkit Mark J. Kilgard Silicon Graphics Inc. November
More informationCS380: Computer Graphics 2D Imaging and Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:
CS380: Computer Graphics 2D Imaging and Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg Class Objectives Write down simple 2D transformation matrixes Understand the
More informationHierarchy I. Guoying Zhao 1 / 40
Computer Graphics Hierarchy I Guoying Zhao 1 / 40 Hierarchical Modeling I Guoying Zhao 2 / 40 Objectives Examine the limitations of linear modeling Symbols and instances Introduce hierarchical models Articulated
More information