Computer Graphics Anatomy of GUI. Computer Graphics CSC470 1
|
|
- Alexina Greene
- 5 years ago
- Views:
Transcription
1 Computer Graphics Anatomy of GUI 1
2 Anatomy of GLUT keyboard mouse OpenGL Application if (key == f key == F ) { glutfullscreen(); } else if(key == w key == W ) { glutreshapewindow(640,480); } display reshape 2
3 Anatomy of GLUT void mykeyboard(unsigned char key, int mousex, int mousey) Runs whenever a keyboard event occurs (e.g. user presses a key) void mymouse(int button, int state, int x, int y) Runs whenever a mouse event occurs (e.g. user presses a mouse button, mouse moves) void mydisplay(void) Runs whenever the system determines that the window must be redrawn (e.g. window comes to the front, window has been moved) void myreshape(void) Runs whenever a window changes size 3
4 Anatomy of GLUT void mykeyboard(unsigned char key, int mousex, int mousey) { if (key == f key == F ) { glutfullscreen(); } else if(key == w key == W ) { glutreshapewindow(640,480); } } 4
5 Anatomy of GLUT int main() { //initialise things //create a screen window glutdisplayfunc(mydisplay); glutreshapefunc(myreshape); glutmousefunc(mymouse); glutkeyboardfunc(mykeyboard); //initialise other things glutmainloop(); } 5
6 Opening a Window Anatomy of GLUT int main(int argc,, char **argv argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_single GLUT RGB); glutinitwindowsize(640,480); glutinitwindowposition(100,100); glutcreatewindow( My OpenGL Window ); glutdisplayfunc(mydisplay); glutreshapefunc(myreshape); glutmousefunc(mymouse); glutkeyboardfunc(mykeyboard); } myinit(); glutmainloop(); 6
7 Example: Mouse Plots How do you draw a dot in the window at the mouse location when the user clicks on the left mouse button? 7
8 Example: Mouse Plots void mymouse(int button, int state, int x, int y) { if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { drawdot(x,, y); } } why the 480 -? 8
9 Example: Keyboard Plots How do you plot points in the window at the current mouse location when the p key is pressed? 9
10 Example: Keyboard Plots void mykeyboard(unsigned char key, int mx, int my) { GLint x = mx,, y = my; switch(key) { case 'p': drawdot(x,y); break; case 27: //ESC exit(-1); default: break; } } 10
11 Example: Mouse Drawing How do you use the mouse to draw freehand in a window? 11
12 Example: Mouse Drawing void mymovedmouse(int mousex, int mousey) { GLint x = mousex; GLint y = mousey; GLint brushsize = 20; glrecti(x,y,, x+ brushsize,, y + brushsize); glflush(); } 12
13 Stippling Stippling means to add a pattern to a simple line or the filling of a polygon. OpenGL allows stippling to be performed using bit patterns. Turn stippling on with: glenable(gl_line_stipple); glenable(gl_poly_stipple); Turn off with: gldisable(gl_line_stipple); gldisable(gl_poly_stipple); 13
14 Line Stippling Defining a line stippling pattern: gllinestipple(glint factor, GLushort pattern); The pattern is a 16 bit sequence of 1s and 0s e.g The factor is a bit multiplier for the pattern (it enlarges it) e.g. factor = 2 turns the above pattern into: The pattern can be expressed in hexadecimal notation e.g. 0xEECC = e.g. gllinestipple(2, 0x7733); 14
15 Stippled Lines cont d To make stippled (dotted or dashed) lines, you use the command gllinestipple( ( ) to define the stipple pattern; Then you enable line stippling with glenable( ( ):) gllinestipple(1, 0x3F07); glenable(gl_line_stipple); Line stippling is disabled by passing argument GL_LINE_STIPPLE to gldisable( ( ).) gldisable(gl_line_stipple); 15
16 Wait a minute.. How do I convert binary to hexadecimal? Hexadecimal character equivalents to 4 bit binary expressions 2. Split the binary into groups of four digits and assign hex values = = E = 1C3 3. Then put 0x in front of the number in your code, e.g. 0xE9 16
17 Line Stippling Lets see it in action glenable(gl_line_stipple); gllinestipple(1, 0x7733); glbegin(gl_line_strip); glvertex2i(10,10); glvertex2i(600,450); glend(); gllinestipple(2, 0xFF00); glbegin(gl_line_strip); glvertex2i(10,30); glvertex2i(600,470); glend(); gllinestipple(5, 0xFF00); glbegin(gl_line_strip); glvertex2i(130,0); glvertex2i(600,430); glend(); glflush(); gldisable(gl_line_stipple); 17
18 Example gllinestipple(1, 0x3F07); The above example and the pattern 0x3F07 (which translates to in binary), a line would be drawn with 3 pixels on, then 5 off, 6 on, and 2 off. (If this seems backward, remember that the t low-order order bits are used first.) If factor had been 2, the pattern would have been elongated: 6 pixels on, 10 off, 12 on, and 4 off. Figure 4.1 shows lines drawn with different patterns and repeat factors. If you don't enable e line stippling, drawing proceeds as if pattern were 0xFFFF and factor 1. (Use gldisable() with GL_LINE_STIPPLE to disable stippling.) Note that stippling can be used in combination with wide lines to produce wide stippled lines. Fig. 4.1: Stippled Lines 18
19 Polygon Stippling Defining a polygon stippling pattern: glpolygonstipple(glubyte mask); The pattern is a 128 byte array of 1s and 0s (32 bits across and 32 bits down) e.g. GLubyte mask[ ] = {0xff, 0xfe, 0x34,..}; The pattern is tiled inside the polygon. e.g. glpolygonstipple(mask); Polygon stippling is enabled and disabled by using glenable( ( ) and gldisable( ( ) with GL_POLYGON_STIPPLE as an argument. 19
20 Polygon Stippling The argument mask is a pointer to a 32 x 32 bitmap that's interpreted as a mask of 0s and 1s. Where a 1 appears, the corresponding pixel in the polygon is drawn, and where a 0 appears, nothing is drawn. Figure 4.2 shows how a stipple pattern is constructed from the characters in mask. 20
21 Polygon Stippling cont d 21
22 Example 2 - Polygon Stippling 22
23 Example 2 - output /* draw one solid, unstippled rectangle, */ /* then two stippled rectangles */ glrectf (25.0, 25.0, 125.0, 125.0); glenable (GL_POLYGON_STIPPLE); glpolygonstipple (fly); glrectf (125.0, 25.0, 225.0, 125.0); glpolygonstipple (fire); glrectf (225.0, 10.0, 400.0, 325.0); gldisable (GL_POLYGON_STIPPLE); 23
24 Polygon Stippling Lets see it in action glenable(gl_polygon_stipple); GLubyte mask[] = {0x31, 0xfe, 0x34, 0x12, 0xff, 0xfc, 0x00, 0x12, 0xaa, 0xfe, 0x00, 0x12, 0xaa, 0xfe, 0x00, 0x12, 0xfc, 0xfe, 0x00, 0x12, 0xff, 0xfe, 0x00, 0x12, }; glpolygonstipple(mask); glbegin(gl_polygon); glvertex2i(10,10); glvertex2i(600,450); glvertex2i(45,300); glvertex2i(240,460); glend(); glflush(); gldisable(gl_polygon_stipple); 24
25 Fitting it in Sometimes you may want to print out a plot of some data when the data ranges are unknown. However, you want them to appear in the window presented in a visually pleasing manner. 25
26 E.g. Let s plot Plotted with screen coordinates of 640 x 480 we will get: Fitting it in e x cos( 2πx) A data plot is no good if we can t see it!! 26
27 Fitting it in How do we MAGNIFY the data? Stretch out X Stretch out Y 27
28 Simple Dot Plots Draw a function for values of x between 0 and 4? Steps: sample it at a collection of equispaced x- values; plot a dot at each coordinate pair (xi, f(xi)); choose some suitable increment, say 0.005, between consecutive x-values. 28
29 Simple Dot Plots cont d glbegin(gl_points); for(gldouble x = 0; x < 4.0 ; x += 0.005) glvertex2d(x, f(x)); glend(); glflush(); Problems: The picture produced will be impossibly tiny because values of x between 0 and 4 map to the first four pixels at the bottom left of the screen window. Further, the negative values of f(.) will lie below the window and will not be seen at all. We therefore need to scale and position the values to be plotted so they cover the screen window area appropriately. 29
30 Fitting it in The X coordinates of the window range over 640 values (from 0 to 639). The X values for the data range from 0 to 4. We need to modify the data values so that data point 0 maps to window coordinate 0 and data point 4 maps to window coordinate
31 Fitting it in In essence we want 4 to be plotted at * A = 640; A = 160;.. or for all cases A = SCREENWIDTH/x max Therefore, x = x * A. if x ranges from 0.. x max 31
32 Fitting it in If x ranges from say 1 to 4 then we will want to stretch a range of 3 out instead of 4, therefore: A = SCREENWIDTH/(x max max x min ) The same applies for the y coordinates: B = SCREENHEIGHT/(y max max -y min ) 32
33 Dot Plots: scaling and shifting Scaling x: Scaling and shifting y: 33
34 Fitting In x = Ax + C and y = By + D A = SCREENWIDTH/(xmax-xmin xmin) C = -xmin*a B = SCREENHEIGHT/(ymax-ymin ymin) D = ymin ymin *B A and B are scalars C and D are translators 34
35 Moving it around 35
36 Setting Values for A, B, C and D The conversions from x to sx, and from y to sy, have the form: where sx = A * x + B sy = C * y + D 36
37 37
38 Example void mydisplay(void) {glbegin(gl_line_strip); for(glfloat x = -4.0; x < 4.0; x += 0.1) { GLfloat y = sin( * x) / ( * x); glvertex2f(x, y); } glend(); glflush();} 38
void drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend();
CSC 706 Computer Graphics Primitives, Stippling, Fitting In OpenGL Primitives Examples: GL_POINTS GL_LINES GL_LINE_STRIP GL_POLYGON GL_LINE_LOOP GL_ TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN
More informationOpenGL Primitives. Examples: Lines. Points. Polylines. void drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend(); }
CSC 706 Computer Graphics Primitives, Stippling, Fitting In Examples: OpenGL Primitives GL_POINTS GL_LINES LINES GL _ LINE _ STRIP GL_POLYGON GL_LINE_LOOP GL_TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN
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 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 information2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-
2.1 What is OpenGL? -23-2. OpenGL -I - Device-independent, application program interface (API) to graphics hardware - 3D-oriented - Event-driven Things OpenGL can do: - wireframe models - depth-cuing effect
More informationComputer Graphics. Making Pictures. Computer Graphics CSC470 1
Computer Graphics Making Pictures Computer Graphics CSC470 1 Getting Started Making Pictures Graphics display: Entire screen (a); windows system (b); [both have usual screen coordinates, with y-axis y
More informationCS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL Skeleton void main(int argc, char** argv){ // First initialize
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 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 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 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 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 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 informationAssignment 1. Simple Graphics program using OpenGL
Assignment 1 Simple Graphics program using OpenGL In this assignment we will use basic OpenGL functions to draw some basic graphical figures. Example: Consider following program to draw a point on screen.
More informationWindows and Viewports. Windows and Viewports. Windows and Viewports. Windows and Viewports. CSC 706 Computer Graphics
CSC 706 Computer Graphics World World Window, Screen Window and Viewport Setting Window and Viewport automatically Tiling Previously we looked at an OpenGL window where x and y were plotted as positive
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 (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 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 information6. Make use of glviewport() to display two sine curves on the same screen, one on the
Duc Nguyen CSE-420: Computer Graphics 10/17/18 1. Modify lines.cpp to display lines in the following patterns: a. a long dash and a dot, (.. ) b. two close dots followed by a distant dot (...... ) 2. Modify
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 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 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 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 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 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 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) 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 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 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 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 informationComputer Graphics: Line Drawing Algorithms
Computer Graphics: Line Drawing Algorithms 1 Graphics hardware The problem scan conversion Considerations Line equations Scan converting algorithms A very simple solution The DDA algorithm, Bresenham algorithm
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 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 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 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 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 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 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 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 informationCS621 Lab 1 Name: Ihab Zbib
CS621 Lab 1 Name: Ihab Zbib 1) The program draw.cpp draws two rectangles and two triangles. The program compiles and executes successfully. What follows are the snap shots of the output. Illustration 1:
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 informationComputer Graphics (CS 543) Lecture 3b: Shader Setup & GLSL Introduction
Computer Graphics (CS 543) Lecture 3b: Shader Setup & GLSL Introduction Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) OpenGL function format function name gluniform3f(x,y,z)
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 informationDrawing and Coordinate Systems
Drawing and Coordinate Systems Coordinate Systems World Coordinate system World window Screen Coordinate system Viewport Window to viewport mapping Screen Coordinate System Glut OpenGL (0,0) 0) Screen
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 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 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 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 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 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 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 informationWorking 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 informationDrawing and Coordinate Systems
Drawing and Coordinate Systems Coordinate Systems Screen Coordinate system World Coordinate system World window Viewport Window to viewport mapping Screen Coordinate System Glut OpenGL (0,0) Screen Coordinate
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 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 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 informationGraphics Hardware and OpenGL
Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1 Camera Views Lines from
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 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 OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL
to to ning Lecture : introduction to Lab : first steps in and - 25/02/2009 Lecture/Lab : transformations and hierarchical - 04/03/2009 to Lecture : lights and materials in - 11/03/2009 Lab : lights and
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 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 informationBob s Concise Introduction to Doxygen
Bob s Concise Introduction to Doxygen by Robert S Laramee Visual and Interactive Computing Group Department of Computer Science Swansea University Swansea, Wales, UK 1 Comment Standard February 14, 2011
More informationComputer Graphics (Basic OpenGL)
Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))
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 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 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 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 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 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 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 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 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 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 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 informationGraphics and Visualization
International University Bremen Spring Semester 2006 Recap Display Devices First Lab Course OpenGL OpenGL is the premier environment for developing portable, interactive 2D and 3D graphics applications.
More informationIntroduction to OpenGL
CS100433 Introduction to OpenGL Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Before OpenGL Let s think what is need
More informationDraw the basic Geometry Objects. Hanyang University
Draw the basic Geometry Objects Hanyang University VERTEX ATTRIBUTE AND GEOMETRIC PRIMITIVES Vertex Vertex A point in 3D space, or a corner of geometric primitives such as triangles, polygons. Vertex attributes
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 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 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 informationEarly History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives
Programming with OpenGL Part 1: Background Early History of APIs Objectives Development of the OpenGL API OpenGL Architecture - OpenGL as a state machine Functions - Types -Formats Simple program IFIPS
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 informationCSCI 2212: Intermediate Programming / C Chapter 15
... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations
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 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 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 informationUSHTRIME NGA GRAFIKA KOMPJUTERIKE
Detyra 1. // lab01.c #include #include #include GLint gjeresiadritares, lartesiadritares, N=10; void boshtet(void) int i; glcolor3f(0.198,.04,.740); glbegin(gl_lines);
More informationPART-I: Lab for MCS-051 (Advanced Internet Technologies)
PART-I: Lab for MCS-051 (Advanced Internet Technologies) Q.1. Write a Program using Servlet and JDBC for developing online application for students attendance management for MCA V semester students of
More informationUNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers
UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers 1. How long would it take to load an 800 by 600 frame buffer with 16 bits per pixel
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 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 informationAndrew Yenalavitch Homework 1 CSE Fall 2014
Andrew Yenalavitch Homework 1 CSE 420 - Fall 2014 1.) ( 20 points ) In the class, we have discussed how to draw a line given by y = m x + b using Besenham's algorithm with m 1. Extend the algorithm to
More informationIntroduction to OpenGL. CSCI 4229/5229 Computer Graphics Fall 2012
Introduction to OpenGL CSCI 4229/5229 Computer Graphics Fall 2012 OpenGL by Example Learn OpenGL by reading nehe.gamedev.net Excellent free tutorial Code available for many platforms and languages OpenGL:
More informationIntroduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives
More informationObjectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Objectives Learn the basic design of a graphics system Introduce graphics
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 informationComputer Graphics, Chapt 08
Computer Graphics, Chapt 08 Creating an Image Components, parts of a scene to be displayed Trees, terrain Furniture, walls Store fronts and street scenes Atoms and molecules Stars and galaxies Describe
More information