Lecture 11: Callbacks. CITS 3003 Graphics & Animation
|
|
- Calvin Andrew Bryan
- 5 years ago
- Views:
Transcription
1 Lecture 11: Callbacks CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012
2 Objectives Learn to build interactive programs using GLUT callbacks o Mouse o Keyboard o Reshape Introduce menus in GLUT 2
3 Recap: Input Modes (cont.) Input modes concern how and when input is obtained There are two types of input modes: o Request mode o Event mode 3
4 Recap: Event Types in event mode input Window event: resize, expose, iconify Mouse event: click one or more buttons Motion event: this refers to the mouse move event (when the cursor is inside the window of the application program) Keyboard: press or release a key Idle: non-event o Define what should be done if no other event is in the event queue 4
5 Recap: Callbacks We can program to handle event mode input We can define a callback function for each type of event that the graphics system recognizes This user-supplied function is executed when the event occurs GLUT example: glutmousefunc(mymouse) mouse callback function 5
6 Interaction with the Window System Window : Used to denote a rectangular area of our display. We are concerned only with raster displays. Has height and width Positions are measured in window coordinates In OpenGL, window coordinates are three-dimensional, whereas screen coordinates are two dimensional. Both systems use units measured in pixels for x and y, but window coordinates retain depth information. The term window system is used to refer to the multiwindow environment provided by systems. 6
7 Window Coordinates Raster Display Systems (0,0) (0,0) Science and Engineering 7
8 Display Resolution A display may have a specific resolution (e.g ) pixels, but the window that we use can have any size. the frame buffer should have a resolution at least equal to the display size. If we use a window of pixels, we can think of it as corresponding to a frame buffer, even though it uses only a part of the real frame buffer. 8
9 Window Creation glutcreatewindow(char *title); Title at the top of the window glutinitdisplaymode(glut_rgb GLUT_DEPTH GLUT_DOUBLE); GLUT_RGB or GLUT_INDEX GLUT_DEPTH : depth buffer for hidden surface removal GLUT_DOUBLE or GLUT_SINGLE glutinitwindowsize(640, 480); 640 width, 480 height glutinitwindowposition(0, 0); Top left corner 9
10 Using Pointing Device Two types of events are associated with the pointing device: Move Event: It is generated when the mouse is moved with one of the buttons depressed. If the mouse is moved without a button being held down, this event is called a passive move event. After a move event, the position of the mouse is made available to the application program. Mouse Event: It occurs when one of the mouse buttons is either depressed or released. When a button is depressed, the action generates a mouse down event. When it is released, a mouse up event is generated. The information returned includes button that generated the event the state of the button after the event (up or down) the position of the cursor tracking the mouse in window coordinates 10
11 The mouse callback glutmousefunc(mymouse); void mymouse(glint button, GLint state, GLint x, GLint y) The parameters passed to the function are: button - which mouse button (GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_RIGHT_BUTTON) caused the event state - state of that button (GLUT_UP, GLUT_DOWN) x, y the mouse click position (in pixels) in the window 11
12 Positioning The position on the screen window is usually measured in pixels with the origin at the top-left corner When the window is refreshed, it is done from top to bottom OpenGL uses a world coordinate system with the origin at the bottom left corner. Thus, you must invert the y coordinate passed to your callback function by the height of the window i.e., y = h y; h (0,0) w 12
13 How to obtain the window size To invert the y position we need to know the window height Note that the window height value can change during program execution We can use a global variable to keep track of the window height value The new window height passed to reshape callback? we will look at this in detail soon glutget(glut_window_width) glutget(glut_window_height) 13
14 Terminating a program In some sample code that we have seen before, we use a keyboard callback function to terminate our program. We can also use the simple mouse callback: void mouse(int btn, int state, int x, int y) { if (btn == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) exit(0); } Note that we ignore the x and y parameters in the example above. 14
15 Using the mouse position In the next example, we show how to draw a small square at the location of the mouse each time the left mouse button is clicked This example does not use the display callback but since one is required by GLUT we will use the empty display callback function mydisplay(){} 15
16 Example-1: Drawing squares at clicked location of cursor void mymouse(int btn, int state, int x, int y) { if (btn == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) exit(0); if (btn == GLUT_LEFT_BUTTON && state == GLUT_DOWN) drawsquare(x, y); } void drawsquare(int x, int y) { y = h-y; /* invert y position */ points[i] = vec2(x+size, y+size); points[i+1] = vec2(x-size, y+size); points[i+2] = vec2(x-size, y-size); points[i+3] = vec2(x+size, y-size); i += 4; } h, size, and i are 3 global variables. Note that in the drawsquare function, variable h is a global variable storing the height (in pixels) of the window. 16
17 Using the motion callback We can draw squares (or anything else) continuously as long as a mouse button is depressed by using the motion callback glutmotionfunc(drawsquare); We can also draw squares without depressing a button using the passive motion callback glutpassivemotionfunc(drawsquare); Exercise: Try changing the previous example by replacing glutmotionfunc by glutpassivemotionfunc 17
18 Example-2: Drawing a single triangle by specifying the vertices (1,1) (0,0) (-1,-1) sets an internal flag indicating that the display needs to be redrawn. 18
19 Using the keyboard callback glutkeyboardfunc(mykey); void mykey(unsigned char key, int x, int y) Parameters passed to the mykey callback function are: key the ASCII code of the key depressed x, y - and mouse location at the time the key was pressed Example: void mykey(unsigned char key, int x, int y) { if (key == Q key == q ) exit(0); } 19
20 Special and Modifier Keys GLUT defines the special keys in glut.h Function key 1: GLUT_KEY_F1 Up arrow key: GLUT_KEY_UP e.g., if (key == GLUT_KEY_F1 Can also check whether one of the modifiers GLUT_ACTIVE_SHIFT GLUT_ACTIVE_CTRL GLUT_ACTIVE_ALT is depressed by glutgetmodifiers() This allows emulation of a three-button mouse with one- or two-button mice 20
21 Reshaping the window We can reshape and resize the OpenGL display window by pulling the corner of the window What happens to the display? The window in the application must be redrawn There are three possibilities: 1. We can display the whole world but force it to fit in the new window (this can alter the aspect ratio). 2. We can display part of the world. 3. We can display and scale the whole world to fit in the window and keep the aspect ratio. 21
22 Reshape possiblities Three reshape possibilities Default original reshaped 22
23 The Reshape callback glutreshapefunc(myreshape); void myreshape(int w, int h) Parameters passed to the function: w, h the width and height of new window (in pixels) What happens when the window is resized: o A redisplay is posted automatically at end of execution of the callback o GLUT has a default reshape callback but you probably want to define your own The reshape callback is a good place to put viewing functions because it is invoked when the window is first opened 23
24 The Reshape callback (cont.) Suppose that the our original window is 500 (width) x 500 (height) pixels and the clipping volume is: left=-0.2, right=0.2, bottom=-0.2, top=0.2, near=2.0, far=20.0. What does the following reshape callback function do? void reshape(int w, int h) { glviewport(0, 0, w, h); Note that near and far clipping planes should be positive; otherwise the clipping volume would be taken as behind the camera. } //glortho(left,right,bottom,top,near,far) glortho(-0.2*(float)w/(float)h, 0.2*(float)w/(float)h, -0.2, 0.2, 2.0, 20.0); No need to call glutpostredisplay( ) here (see previous slide) glortho: 24
25 The Reshape callback (cont.) Same setting as described on the previous slide. What does the following reshape callback function do? void reshape(int w, int h) { glviewport(0, 0, w, h); if (w > h) glortho(-0.2*(float)w/(float)h, } 0.2*(float)w/(float)h, -0.2, 0.2, 2.0, 20.0); else glortho(-0.2, 0.2, -0.2*(float)h/(float)w, 0.2*(float)h/(float)w, 2.0, 20.0); 25
26 Idle Callback Invoked when there are no other events. Its default is the null function pointer. Uses: continue to generate graphical primitives through a display function while nothing else is happening to produce an animated display. In main, we specify an idle callback, glutidlefunc(idle); 26
27 Example: Idle Callback 27
28 Toolkits and Widgets Most window systems provide a toolkit or library of functions for building user interfaces that use special types of windows called widgets Widget sets include tools such as o Menus o Slidebars o Dials o Input boxes But toolkits tend to be platform dependent GLUT provides a few widgets including menus 28
29 Menus GLUT supports pop-up menus o A menu can have submenus Three steps for setting up a menu: 1) Define entries for the menu 2) Define action for each menu item o Action carried out if an entry is selected 3) Attach menu to a mouse button 29
30 Defining a simple menu In the main or init function: a unique ID returned by glut name of the callback function menu_id = glutcreatemenu(mymenu); glutaddmenuentry( clear Screen, 1); gluaddmenuentry( exit, 2); glutattachmenu(glut_right_button); clear screen exit entries that will appear when right button is pressed identifiers 30
31 Menu actions Example of a simple menu callback function: void mymenu(int id) { if (id == 1) glclear(); if (id == 2) exit(0); } Note when each menu is created, a unique id is returned by glut To add a submenu, use glutaddsubmenu: glutaddsubmenu(char *submenuname, int submenuid) To add a menu entry, use glutaddmenuentry: glutaddmenuentry(char *entryname, int entryid) To attach the current menu, use glutattachmenu. 31
32 Menu an example // submenu for two light sources int lightmenuid = glutcreatemenu(lightmenu); glutaddmenuentry("move Light 1", 11); glutaddmenuentry("change RGB of Light 1", 12); glutaddmenuentry("move Light 2", 21); glutaddmenuentry("change RGB of Light 2", 22); Put these lines of code in an init function // submenu for camera int cameramenuid = glutcreatemenu(cameramenu); Callback functions // add these submenus to the main menu glutcreatemenu(mainmenu); glutaddsubmenu("light sources", lightmenuid); glutaddsubmenu("camera", cameramenuid); glutattachmenu(glut_right_button); Always create the submenus before the main menu 32
33 Menu an example // callback function for the light menu void lightmenu(int id) { switch (id) { case 11: // action for moving light 1 case 12: // action for changing RGB of light 1... } } // callback function for the camera menu void cameramenu(int id) {... } 33
34 Mid-Semester Test When Tuesday 10 April during the lecture 12:00-12:45PM Where In ENCM [G04] i.e. where Tuesday lectures are held What is included Everything from Lecture 1 to Lecture 10 What to bring to the test A pen to write with (no pencils, no books, no notes) See unit website for sample test from me=lectures 34
35 Further Reading Interactive Computer Graphics A Top-Down Approach with Shader-Based OpenGL by Edward Angel and Dave Shreiner, 6 th Ed, 2012 Sec. 2.7 Control Functions Sec Adding Interaction up to Sec The Idle Callback Sec 2.12 Menus C++ code in the Chapter04 - Chapter09 folders 35
Working with Callbacks
Working with Callbacks 1 Objectives Learn to build interactive programs using GLUT callbacks Mouse Keyboard Reshape Introduce menus in GLUT 2 The mouse callback glutmousefunc(mymouse) void mymouse(glint
More informationInput and Interaction
Input and Interaction Adapted from Edward Angel, UNM! Angel: Interactive Computer Graphics 3E Addison-Wesley 2002 Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm
More informationProject Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics:
Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: User sees an object on the display User points to (picks) the object
More informationComp 410/510 Computer Graphics Spring Input & Interaction
Comp 410/510 Computer Graphics Spring 2018 Input & Interaction Objectives Introduce the basic input devices - Physical Devices - Logical Devices Event-driven input Input Modes Programming event input with
More informationLecture 4. Interaction / Graphical Devices. CS 354 Computer Graphics Sunday, January 20, 13
Lecture 4 Interaction / Graphical Devices Graphical Input Devices can be described either by - Physical properties Mouse Keyboard Trackball - Logical Properties What is returned to program via API A position
More informationInput and Interaction. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Input and Interaction CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science E. Angel and D. Shreiner : Interactive Computer Graphics 6E Addison-Wesley 2012 1 Objectives
More informationInput, Interaction and Animation Week 2
CS 432/637 INTERACTIVE COMPUTER GRAPHICS Input, Interaction and Animation Week 2 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 3 Part 3 Input and Interactions Matt Burlick - Drexel University - CS432 1 Reading Angel: Chapter 2 Red Book: Chapter 2 Matt Burlick - Drexel University - CS432
More informationLecture 10: Input, Interaction & callbacks. CITS 3003 Graphics & Animation
Lecture 10: Input, Interaction & callbacks CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the basic input devices
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics GLUT (Continue) More Interactions Yong Cao Virginia Tech References: Interactive Computer Graphics, Fourth Edition, Ed Angle Orthographical Projection Synthetic camera model View
More informationInput and Interaction. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
Input and Interaction Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Introduce the basic input devices - Physical Devices
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 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. 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 informationCSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science
CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming GLUT 2 Events in OpenGL Event Example Keypress KeyDown KeyUp Mouse leftbuttondown leftbuttonup With mouse
More informationComputer Graphics (CS 4731) OpenGL/GLUT (Part 2)
Computer Graphics (CS 4731) Lecture 3: Introduction to OpenGL/GLUT (Part 2) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Triangulation Generally OpenGL breaks polygonsdownintotriangles
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 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 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 informationLecture 2 Sections 3.6, 3.7. Fri, Aug 28, 2009
User User Lecture 2 Sections 3.6, 3.7 Hampden-Sydney College Fri, Aug 28, 2009 Outline User 1 2 3 4 5 User Definition ( ) A callback function is a programmer-specified function that the library will call
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 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 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 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 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 informationCS Computer Graphics: OpenGL, Continued
CS 543 - Computer Graphics: OpenGL, Continued by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Last time. OpenGL set up Basic structure OpenGL skeleton Callback functions, etc. R.W.
More informationCS Computer Graphics: OpenGL, Continued
CS 543 - Computer Graphics: OpenGL, Continued by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Last time. OpenGL set up Basic structure OpenGL skeleton Callback functions, etc. R.W.
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 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 informationCS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II. Emmanuel Agu
CS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II Emmanuel Agu Recall: OpenGL Skeleton void main(int argc, char** argv){ // First initialize toolkit, set display mode and create window glutinit(&argc,
More informationVTU EDUSAT PROGRAMME. Computer Graphics & Visualization
VTU EDUSAT PROGRAMME Computer Graphics & Visualization Interactions in Open GL using GLUT And Graphics Pipeline Sandeep Senan Interactions in Open GL using GLUT Ivan Sutherland (MIT 1963) established the
More informationGLUT Tutorial. Keyboard
GLUT Tutorial Keyboard GLUT allows us to build applications that detect keyboard input using either the "normal" keys, or the special keys like F1 and Up. In this section we'll see how to detect which
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 informationCS 548: COMPUTER GRAPHICS GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE
CS 548: COMPUTER GRAPHICS GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE INTRODUCTION Apart from creating the window, GLUT also allows accessing the mouse and keyboard as well as creating popup
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 informationImage Processing. Geometry Processing. Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Display
CMSC 427: Chapter 2 Graphics Libraries and OpenGL Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Graphics Libraries OpenGL and its Structure Drawing Primitives in OpenGL GLUT
More informationComputer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1)
Computer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) OpenGL/GLUT Installation OpenGL: Specific
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 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 informationCMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013
CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013 Reading: See any standard reference on OpenGL or GLUT. Basic Drawing: In the previous lecture, we showed how to create a window in GLUT,
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 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 informationCSCI 4620/8626. The 2D Viewing Pipeline
CSCI 4620/8626 Computer Graphics Two-Dimensional Viewing (Chapter 8) Last update: 2016-03-3 The 2D Viewing Pipeline Given a 2D scene, we select the part of it that we wish to see (render, display) using
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 1 Part 3 Anatomy of OpenGL Programs Matt Burlick - Drexel University - CS 432 1 Reading Angel Chapter 2 Red Book Chapter 4 Matt Burlick - Drexel University
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 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 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 informationComputer Graphics 1 Computer Graphics 1
Projects: an example Developed by Nate Robbins Shapes Tutorial What is OpenGL? Graphics rendering API high-quality color images composed of geometric and image primitives window system independent operating
More information1 (Practice 1) Introduction to OpenGL
1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,
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 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 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 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 informationCS 543 Lecture 1 (Part II): Intro to OpenGL and GLUT (Part I) Emmanuel Agu
CS 543 Lecture 1 (Part II): Intro to OpenGL and GLUT (Part I) Emmanuel Agu OpenGL Basics OpenGL s function Rendering Rendering? Convert geometric/mathematical object descriptions into images OpenGL can
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 informationComputer Graphics (CS 4731) OpenGL/GLUT(Part 1)
Computer Graphics (CS 4731) Lecture 2: Introduction to OpenGL/GLUT(Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL GLBasics OpenGL s function Rendering
More 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 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 informationCS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.
CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL
More informationComputer graphic -- Programming with OpenGL 2
Computer graphic -- Programming with OpenGL 2 OpenGL OpenGL (Open Graphics Library) a cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is typically used to interact
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 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 informationExercise 1 Introduction to OpenGL
Exercise 1 Introduction to OpenGL What we are going to do OpenGL Glut Small Example using OpenGl and Glut Alexandra Junghans 2 What is OpenGL? OpenGL Two Parts most widely used and supported graphics API
More informationInput and Interaction
Input and Interaction Interactive program is something make CG look interesting Suriyong L., Computer Multimedia 1 Physical Input Devices 2 Types Pointing devices Locate or indicate position on screen
More informationCS Computer Graphics: Intro to OpenGL
CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect
More informationCS Computer Graphics: Intro to OpenGL
CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect
More informationCMSC 427 Computer Graphics 1
CMSC 427 Computer Graphics 1 David M. Mount Department of Computer Science University of Maryland Fall 2013 1 Copyright, David M. Mount, 2013 Dept. of Computer Science, University of Maryland, College
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 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 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 informationAnnouncement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12
Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES
More 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 informationOPENGL TM AND X, COLUMN 1: AN OPENGL TOOLKIT
Copyright c1994 Mark J. Kilgard. All rights reserved. PUBLISHED IN THE NOVEMBER/DECEMBER 1994 ISSUE OF The X Journal. OPENGL TM AND X, COLUMN 1: AN OPENGL TOOLKIT Mark J. Kilgard Silicon Graphics Inc.
More informationComputer Graphics. Downloaded from: LectureNotes 1 CSC-254
Computer Graphics Downloaded from: http://www.bsccsit.com LectureNotes 1 CSC-254 Lecture 1: Course Introduction Reading: Chapter 1 in Hearn and Baker. Computer Graphics: Computer graphics is concerned
More informationLecture 12: Mid-term test solution & project. CITS 3003 Graphics & Animation
Lecture 12: Mid-term test solution & project CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Explain solution to the mid-term
More informationToday s class. Viewing transformation Menus Mandelbrot set and pixel drawing. Informationsteknologi
Today s class Viewing transformation Menus Mandelbrot set and pixel drawing Monday, November 2, 27 Computer Graphics - Class 7 The world & the window World coordinates describe the coordinate system used
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 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
Input and Interaction 5 th Week, 2011 Graphical Input Devices Mouse Trackball Light Pen Data Tablet Joy Stick Space Ball Input Modes Input devices contain a trigger which can be used to send a signal to
More informationCS380: Computer Graphics Basic OpenGL Structure. Sung-Eui Yoon ( 윤성의 ) Course URL:
CS380: Computer Graphics Basic OpenGL Structure Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg Class Objectives Understand the basic OpenGL program structure and how OpenGL supports
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 information3D computer graphics: geometric modeling of objects in the computer and rendering them
SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering
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 informationCGT521 OpenGL Utility Toolkit
Lecture Overview CGT521 OpenGL Utility Toolkit Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics 1) GLUT philosophy and basis 2) Initialization 3) Event process 4) Window management
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 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 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 informationComputer 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 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 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 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 informationDONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM
DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM DEMO MODEL-VIEW-CONTROLLER DESIGN canonical.cpp The main program canonical.cpp acts as the controller, directing Model and actions
More informationAPI Background. Prof. George Wolberg Dept. of Computer Science City College of New York
API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer
More 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 informationAbel J. P. Gomes LAB. 1. INTRODUCTION TO OpenGL
Visual Computing and Multimedia Abel J. P. Gomes 1. Getting Started 2. Installing Graphics Libraries: OpenGL and GLUT 3. Setting up an IDE to run graphics programs in OpenGL/GLUT 4. A First OpenGL/GLUT
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 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 informationAdvanced Computer Graphics (CS & SE )
Advanced Computer Graphics (CS & SE 233.420) Topics Covered Picking Pipeline Viewing and Transformations Rendering Modes OpenGL can render in one of three modes selected by glrendermode(mode) GL_RENDER
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 information