20 GLuint objects; 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN:
|
|
- Crystal Caldwell
- 5 years ago
- Views:
Transcription
1 #include <stdio.h> 2 #include <GL/glut.h> 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; // Y 9 static float MoveX = 0; // X 10 static float MoveY = 0; // Y 11 static float Scale = 0.5; // // 14 unsigned long TimeCounter; 15 // 16 #define NOBJECTS 3 17 // 18 unsigned long touchtime[nobjects]; 19 /* */ 20 GLuint objects; 21 /* */ 22 #define SELECTIONS void timer(int t) // T i m e r 25 { 26 TimeCounter++; 27 glutpostredisplay (); 28 gluttimerfunc(20, timer, 20); 29 } void specialkey(int key, int x, int y) 32 { 33 switch (key) { 34 case GLUT_KEY_UP: 35 printf("(%3d,%3d) [ ] \ n", x, y); 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN: 39 printf("(%3d,%3d) [ ] \ n", x, y); 40 Scale -= 0.1; 41 break; 42 } 43 glutpostredisplay (); 44 } static int MouseLB_ON=0; // 47 static int MouseRB_ON=0; // void mouse(int button, int state, int x, int y) 50 { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ 53 MouseLB_ON = 1; printf("(%3d,%3d) \ n", x, y); //************************************************************************************** 56 // 57 GLuint selection[selections]; // 58 glselectbuffer(selections, selection); // 61 glrendermode(gl_select); 62 glinitnames(); // 63 glpushname(-1); // // 66 glmatrixmode(gl_projection); 67 glpushmatrix (); // 68 glloadidentity (); // // 71 GLint viewport [4]; 72 glgetintegerv(gl_viewport, viewport); 73 //printf("viewport=%d,%d,%d,%d\n",viewport[0],viewport[1],viewport[2],viewport [3]); // 76 // 77 glupickmatrix(x, viewport[3]-y, 1, 1, viewport); 78 1
2 79 // 80 gluperspective (30.0, (double)viewport[2] / (double)viewport[3], 1.0, 100.0); // 83 glmatrixmode(gl_modelview); 84 glpushmatrix (); // 85 glloadidentity (); // // 88 glulookat(5.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 91 glpushmatrix (); glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 94 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 95 glscalef(scale, Scale, Scale); // S c a l e /* */ 98 // A 99 glloadname (0); // 100 glpushmatrix (); 101 gltranslatef(-2.0, 0.0, 0.0); // X if(touchtime[0] > 0) { 103 glrotatef((timecounter - touchtime [0])*10, 1.0, 0.0, 0.0); 104 if((timecounter - touchtime [0]) > 8) touchtime[0] = 0; 105 } 106 glbegin(gl_quads); 107 glnormal3f(1, 0, 0); 108 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 109 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 110 glend(); 111 glpopmatrix(); // B 114 glloadname (1); // 115 glpushmatrix (); 116 gltranslatef(0.0, 0.0, 0.0); // 117 if(touchtime[1] > 0) { 118 glrotatef((timecounter - touchtime [1])*10, 1.0, 0.0, 0.0); 119 if((timecounter - touchtime [1]) > 8) touchtime[1] = 0; 120 } 121 glbegin(gl_quads); 122 glnormal3f(1, 0, 0); 123 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 124 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 125 glend(); 126 glpopmatrix(); // C 129 glloadname (2); // 130 glpushmatrix (); 131 gltranslatef(2.0, 0.0, 0.0); // X if(touchtime[2] > 0) { 133 glrotatef((timecounter - touchtime [2])*10, 1.0, 0.0, 0.0); 134 if((timecounter - touchtime [2]) > 8) touchtime[2] = 0; 135 } 136 glbegin(gl_quads); 137 glnormal3f(1, 0, 0); 138 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 139 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 140 glend(); 141 glpopmatrix(); glpopmatrix(); // 146 glmatrixmode(gl_projection); 147 glpopmatrix(); // // 150 glmatrixmode(gl_modelview); 151 glpopmatrix(); // // 154 GLint hits = 0; // 155 hits = glrendermode(gl_render); // 158 printf("hits = %d\n", hits); // for (int i = 0; i < hits; i++) { 161 printf("%dth Obj\n", i); 162 // ( 1) 163 printf("(nofstack )[%3d]\n", selection[i*4+0]); 164 // 165 printf("(znear)[%3f] ", (double)selection[i*4+1] / (double)0x7fffffff); 166 // 2
3 167 printf("(zfar)[%3f]\n", (double)selection[i*4+2] / (double)0x7fffffff); 168 // i+4 I D 169 printf("(name)[%3d]\n", selection[i*4+3]); 170 printf("\n"); 171 // 172 touchtime[selection[i*4+3]] = TimeCounter; 173 } 174 //************************************************************************************** //************************************************************************************** 177 // // 180 GLdouble modelmat[16], projmat [16]; 181 glgetdoublev(gl_modelview_matrix, modelmat); 182 glgetdoublev(gl_projection_matrix, projmat); // Z 185 GLfloat z; 186 glreadpixels(x, viewport[3] - y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); 187 //3 188 GLdouble ox, oy, oz; 189 gluunproject(x, viewport[3] - y, z, modelmat, projmat, viewport, &ox, &oy, &oz); 190 printf("3d Coordinates\n"); 191 printf("x=%3.2f,y=%3.2f,z=%3.2f\n", ox, oy, oz); 192 //************************************************************************************** }else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP){ 195 MouseLB_ON = 0; printf("(%3d,%3d) \ n", x, y); 196 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN){ 197 MouseRB_ON = 1; printf("(%3d,%3d) \ n", x, y); 198 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP){ 199 MouseRB_ON = 0; printf("(%3d,%3d) \ n", x, y); 200 } glutpostredisplay (); 203 } void dragmotion(int x, int y) 206 { 207 if (MouseLB_ON == 1){ 208 printf("(%3d,%3d)...\ n", x, y); 209 } 210 else if (MouseRB_ON == 1){ 211 printf("(%3d,%3d)...\ n", x, y); 212 // 213 SpinX += x - MouseX; 214 SpinY += y - MouseY; 215 // 216 MouseX = x; 217 MouseY = y; 218 glutpostredisplay (); 219 } 220 } void reshape(int w, int h) // R e s h a p e 223 { 224 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 227 glloadidentity (); 228 gluperspective (30.0, (double)w/h, 1.0, 100.0); // glmatrixmode(gl_modelview); 231 glloadidentity (); 232 glulookat(5.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 233 } void display(void) // D i s p l a y 236 { 237 glclearcolor(0.0, 0.0, 0.0, 1.0); // 238 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 239 glenable(gl_depth_test); // // 242 GLfloat mat1diff[] = { 0.8, 0.2, 0.2, 1.0 }; // 243 GLfloat mat2diff[] = { 0.2, 0.8, 0.2, 1.0 }; // 244 GLfloat mat3diff[] = { 0.2, 0.2, 0.8, 1.0 }; // glpushmatrix(); 247 glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 248 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 249 glscalef(scale, Scale, Scale); // S c a l e // A 252 glpushmatrix(); 253 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 254 gltranslatef(-2.0, 0.0, 0.0); // X
4 255 if(touchtime[0] > 0) { 256 glrotatef((timecounter - touchtime [0])*10, 1.0, 0.0, 0.0); 257 if((timecounter - touchtime [0]) > 8) touchtime[0] = 0; 258 } 259 glbegin(gl_quads); 260 glnormal3f(1, 0, 0); 261 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 262 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 263 glend(); 264 glpopmatrix(); 265 // B 266 glpushmatrix(); 267 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 268 gltranslatef(0.0, 0.0, 0.0); // 269 if(touchtime[1] > 0) { 270 glrotatef((timecounter - touchtime [1])*10, 1.0, 0.0, 0.0); 271 if((timecounter - touchtime [1]) > 8) touchtime[1] = 0; 272 } 273 glbegin(gl_quads); 274 glnormal3f(1, 0, 0); 275 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 276 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 277 glend(); 278 glpopmatrix(); 279 // C 280 glpushmatrix(); 281 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 282 gltranslatef(2.0, 0.0, 0.0); // X if(touchtime[2] > 0) { 284 glrotatef((timecounter - touchtime [2])*10, 1.0, 0.0, 0.0); 285 if((timecounter - touchtime [2]) > 8) touchtime[2] = 0; 286 } 287 glbegin(gl_quads); 288 glnormal3f(1, 0, 0); 289 glvertex3f(0, 1, 1); glvertex3f(0, 1,-1); 290 glvertex3f(0,-1,-1); glvertex3f(0,-1, 1); 291 glend(); 292 glpopmatrix(); 293 glpopmatrix(); // 296 glpushmatrix(); // X 297 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 298 glnormal3f(0.0, 1.0, 0.0); // 299 glbegin(gl_lines); 300 glvertex3f (0.0f, 0.0f, 0.0f); 301 glvertex3f (2.0f, 0.0f, 0.0f); 302 glend(); 303 glpopmatrix(); 304 glpushmatrix(); // Y 305 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 306 glnormal3f(0.0, 1.0, 0.0); // 307 glbegin(gl_lines); 308 glvertex3f (0.0f, 0.0f, 0.0f); 309 glvertex3f (0.0f, 2.0f, 0.0f); 310 glend(); 311 glpopmatrix(); 312 glpushmatrix(); // Z 313 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 314 glnormal3f(0.0, 1.0, 0.0); // 315 glbegin(gl_lines); 316 glvertex3f (0.0f, 0.0f, 0.0f); 317 glvertex3f (0.0f, 0.0f, 2.0f); 318 glend(); 319 glpopmatrix(); glutswapbuffers (); // 322 } void lightinit(void) // ( ) 325 { 326 glenable(gl_lighting); // 327 glenable(gl_light0); //0 (8 ) 328 glenable(gl_normalize); // GLfloat light0pos[] = { 5.0, 5.0, 0.0, 1.0 }; 331 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 334 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 336 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 338 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 341 } 342 4
5 343 int main(int argc, char *argv[]) 344 { 345 glutinit(&argc, argv); // G L U T 346 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 347 glutinitwindowsize(640, 480); // 348 glutcreatewindow("window"); // 349 glutreshapefunc(reshape); // R e s h a p e 350 glutdisplayfunc(display); // D i s p l a y glutmousefunc(mouse); // 353 glutmotionfunc(dragmotion); // 354 glutspecialfunc(specialkey); // ( ) 355 gluttimerfunc(20, timer, 20); // lightinit(); // ( ) /* */ 360 for (int i = 0; i < NOBJECTS; i++) touchtime[i] = 0; glutmainloop(); // return 0; 365 } 5
1 /* 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 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 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 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 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 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 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 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 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 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 informationPhilip Calderon CSE 520 Lab 3 Color Shader
Philip Calderon CSE 520 Lab 3 Color Shader Summary: The purpose of lab 4 is to produce a pyramid tetrahedron that we are able to rotate it when clicked. Part 1: Color Tetrahedron Part 2: Rotation to show
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 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 informationComputer graphics MN1
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,
More informationErik Anchondo cse 520 lab 4
Erik Anchondo 2-6-19 cse 520 lab 4 1. Wrote a glsl program that displays a colored tetrahedron. The tetrahedron starts to rotate on the x axis when the mouse button is clicked once. If the mouse button
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 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 informationPearce Outline. OpenGL Background and History. Other Graphics Technology. 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 JOGL and GLUT Resources Some images in
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 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 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 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 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 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 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 informationChapter 10: Events and Event Handling for Computer Graphics
Chapter 10: Events and Event Handling for Computer Graphics Introduction Graphics programming can focus entirely on creating one single image based on a set of data, but more and more we are seeing the
More informationScientific Visualization Basics
Scientific Visualization Basics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Dept. of Computer Science, Dept. of Physics & Astronomy, Dept. of Chemical Engineering & Materials Science,
More informationBOUNCING BALL IMRAN IHSAN ASSISTANT PROFESSOR
COMPUTER GRAPHICS LECTURE 07 BOUNCING BALL IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM /* * GL07BouncingBall.cpp: A ball bouncing inside the window */ #include // for MS Windows #include
More informationcompatibility mode core mode
Using the GLUT This document provides a more detailed description of the minimum steps necessary to write build and execute an OpenGL 3D application that runs on the three desktop platforms Windows, OSX
More informationLighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following:
Chapter 5 Lighting Chapter Objectives After reading this chapter, you'll be able to do the following: Understand how real-world lighting conditions are approximated by OpenGL Render illuminated objects
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 information2a. The triangles scale increases (expands) when the 'e' key is pressed and decreases (contracts) when the 'c' key is pressed.
Erik Anchondo 1-29-19 cse 520 lab 3 1. Wrote a shader program to display three colored triangles, with one of each triangle being red, green, and blue. The colors change which triangle they are applied
More informationUnderstand how real-world lighting conditions are approximated by OpenGL
OpenGL Programming Guide (Addison-Wesley Publishing Company) Chapter 5 Lighting Chapter Objectives After reading this chapter, you ll be able to do the following: Understand how real-world lighting conditions
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 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 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 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 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 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 informationCheating: In case of cheating, all parts involved (source(s) and receiver(s)) get zero.
REGULATIONS Due date: 19.11.2009 Thursday 23:59 Late Submission: Late submission is not allowed. Submission: Use the COW system to submit your homework file. The homework should be done and submitted individually.
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 informationyahoo.com
What is the workshop about? We use software such as AutoCAD, 3D Studio, Maya and many others for a host of applications ranging from Technical Drawings to Machine Design to Game Making to Special Effects
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 informationFourier Series. Given a periodic function, x(t), (-T <t <T): + b n sin n t T. a n cos n t T. 2 a 0 + Z T. a n = 1 T. x(t) cos n t T. b n = 1 T.
x(t) = 1 1X 2 a 0 + Fourier Series Given a periodic function, x(t), (-T
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 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 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 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 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 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 information1)Write a shader program that renders a regular pentagon with textured image like the one shown below.
Andrew Yenalavitch CSE520 Winter 2015 Quiz 2 Report 1)Write a shader program that renders a regular pentagon with textured image like the one shown below. Use the following provided image for the texture:
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 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 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 informationProgramming Graphic Processing Units with CUDA. Paolo Burgio
Programming Graphic Processing Units with CUDA Paolo Burgio paolo.burgio@unimore.it Graphics Processing Units (Co-)processor devoted to graphics Built as "monolithical" chip Integrated as co-processor
More information1) Here is the various stages of the tetrahedron:
Andrew Yenalavitch Homework 3 CSE 520 - Winter 2015 1) ( 20 points ) Write a shader program that renders a colored tetrahedron, which gradually shrinks to a point and expands back to its original shape.
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 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 information1. Write a shader program that animates the morphing of Figure 'A' to Figure 'B' and back.
Karl Zachary Maier CSE 520 Homework 1 1. Write a shader program that animates the morphing of Figure 'A' to Figure 'B' and back. /* morph.cpp */ #include #include #include
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 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 informationSource code: #include <iostream>
Andrew Yenalavitch Homework 4 CSE 520 - Winter 2015 1. ( 10 points ) Write a program that finds the knot vector ( u 0,..., u n-1 ) of a B-spline. It asks for 'number of control points' and 'degree of spline'
More informationThis Lecture. Why OpenGL? Introduction to OpenGL. Programmer s View
Foundations of Computer Graphics Overview and Motivation This Lecture Introduction to OpenGL and simple demo code mytest1.cpp ; you compiled mytest3.cpp for HW 0 I am going to show (and write) actual code
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 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 informationVisualizing Molecular Dynamics
Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials
More information12. Selection. - The objects selected are specified by hit records in the selection buffer. E.R. Bachmann & P.L. McDowell MV 4202 Page 1 of 13
12. Selection Picking is a method of capturing mouse clicks at some window position and determining what objects are beneath it. The basic idea is to enter the selection rendering mode with a small viewing
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 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 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 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 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 informationTo Do. Demo: Surreal (HW 3) This Lecture. Introduction to OpenGL. Outline. Foundations of Computer Graphics (Spring 2012)
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 6: OpenGL 1 http://inst.eecs.berkeley.edu/~cs184 To Do HW 1 due on Thu Must find partners for HW 2 (if problems, speak to TAs during section).
More informationLattice Gas Cellular Automaton Model for Fluid Flow
Lattice Gas Cellular Automaton Model for Fluid Flow lgca.cpp // Lattice Gas Cellular Automaton Model for Fluid Flow 1 #include 3 #include 4 #include 5 using namespace std;
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 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 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 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 information(21) OpenGL GUI. OpenGL GUI 1 UNIX MAGAZINE UNIX. SGI (Silicon Graphics Inc.) Windows PC GUI. UNIX Windows GUI. Java. 1 prefposition() X X
(21) OpenGL GUI UNIX Windows Macintosh UNIX Windows PC SGI (Silicon Graphics Inc.) Windows PC GUI UNIX Windows GUI Java OpenGL OpenGL SGI 3 / GL GUI OpenGL GL OpenGL SGI 3 GL SGI 3 / 3 1 GL /* GL sample
More informationChapter 7 Display Lists
OpenGL Programming Guide (Addison-Wesley Publishing Company) Chapter 7 Display Lists Chapter Objectives After reading this chapter, you ll be able to do the following: Understand how display lists can
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 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 informationCOMPSCI 373 S1 C - Assignment 2 Sample Solution
COMPSCI 373 S1 C Assignment 2 Sample Solution 1 of 17 Computer Science COMPSCI 373 S1 C - Assignment 2 Sample Solution This assignment is worth 8.3333% of your final grade. 1. 3D Modelling and Texture
More informationOpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL
OpenGL OpenGL OpenGL Is a mechanism to create images in a frame buffer Is an API to access that mechanism Is well specified OpenGL Is not a window system Is not a user interface Is not a display mechanism
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 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 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 information1) Program to display a set of values {fij} as a rectangular mesh. #include<gl/glut.h> #define maxx 20. #define maxy 20. #define dx 15.
1) Program to display a set of values fij as a rectangular mesh. #include #define maxx 20 #define maxy 20 #define dx 15 #define dy 20 GLfloat x[maxx]=0.0,y[maxy]=0.0; GLfloat x0=50,y01=50; GLint
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 informationRendering Pipeline/ OpenGL
Chapter 2 Basics of Computer Graphics: Course Info/Policies (boring stuff): Course Info/Policies (boring stuff): http:www.ugrad.cs.ubc.ca/~cs314 Page 1 1 Grading Programming Assignments: 40% Weekly Mini
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 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 informationGLUT Tutorial. John Tsiombikas (Nuclear / The Lab Demos) May 6, Introduction to GLUT (OpenGL Utility Toolkit)
GLUT Tutorial John Tsiombikas (Nuclear / The Lab Demos) May 6, 2005 1 Introduction to GLUT (OpenGL Utility Toolkit) This is an introductory text, for those who are interested in using the OpenGL library
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 information3D Graphics and API with OpenGL
3D Graphics and API with OpenGL Human-Centered CAD Lab. 29-3-3 Contents 3D Graphics API & OpenGL Interactive Computer Graphics Example of OpenGL Programming Preparatory Simple code GLUT Functions Transformation
More informationComputer Graphics Introduction to OpenGL
Computer Graphics 2013 3. Introduction to OpenGL Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2013-09-16 2. 2D Graphics Algorithms (cont.) Rasterization Scan converting lines start
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 informationCSE4030 Introduction to Computer Graphics
CSE4030 Introduction to Computer Graphics Dongguk University Jeong-Mo Hong Week 2 The first step on a journey to the virtual world An introduction to computer graphics and interactive techniques How to
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 information