Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1
|
|
- Jason Davis
- 5 years ago
- Views:
Transcription
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 from 0 to 18 and plot the results. Show your steps. (10 Points) Steps 1. Points (x0, y0) = (0, 0) (x1, y1) = (18, 6) 2. Calculate Deltas dy = y1 - y0 = 6-0 = 6 dx = x1 - x0 = 18-0 = Calculate 2 * Deltas 2dy = 2 * 6 = 12 2dx = 2 * 18 = Deltas give P 0 P 0 = 2dy - dx 5. Use Upper or Lower formula depending if P < 0; P k < 0 (x k + 1, y k ) is next plot point P k + 1 = P k + 2dy P k > 0 (x k + 1, y k + 1) is next plot point P k +1 = P k +2dy - 2dx
2 6. Values x0 x1 dx 2dx y0 y1 dy 2dy Plotting k P Upper or Lower Eq. Plug Numbers P x y 0 P0 P 0 = 2dy - dx P1 P1 = P0 + 2dy P2 P2 = P1 + 2dy - 2dx P3 P3 = P2 + 2dy
3 2. Use OpenGL to draw a dot plot of the function f(x) = e - x sin ( 2πx ), whx ), where it is known that as x varies from x low to x high, f(x) takes on values between from y low to y high. Find the appropriate scaling and translation factors so that the dots will lie properly in a screen window with width W pixels and height H pixels. (10 Points) To see the Graph, I changed the values of gluortho2d(-5, 5, -5, 5);
4 3. Use turtle graphics or/and other means to reproduce any 3 of the following images (10 points).
5
6
7 Problem 2 #include <GL/glut.h> #include <math.h> void init(void) glclearcolor(1, 1, 1, 0); glcolor3f(1.0f, 0.0f, 0.0f); glpointsize(4.0); glmatrixmode(gl_projection); glloadidentity(); gluortho2d(-5, 5, -5, 5); float f(float x) return exp(-fabs(x)) * sin(2 * 3.14*x); void display(void) glclear(gl_color_buffer_bit); glviewport(0, 0, 500, 500); for (float x = -6.28; x <= 6.28; x += 0.1) glvertex2f(x, f(x)); glcolor3f(0.0, 0.0, 0.0); glbegin(gl_lines); glvertex2f(-50, 0); glvertex2f(50, 0); glvertex2f(0, -50); glvertex2f(0, 50); glflush();
8 int main(int argc, char** argv) glutinit(&argc, argv); glutinitwindowsize(500, 500); glutinitwindowposition(100, 150); glutcreatewindow("cse-420: Homework 1, Graph"); init(); glutdisplayfunc(display); glutmainloop(); return 0;
9 Problem 3: Turtle #include <GL/glut.h> #include <math.h> #include <stdio.h> //initialization void init(void) glclearcolor(1, 1, 1, 0); glpointsize(4.0); //a dot is 4x4 glmatrixmode(gl_projection); glloadidentity(); //replace current matrix with identity matrix gluortho2d(0, 800, -100, 700); //gluortho2d(left, RIGHT, BOTTOM, TOP); void display(void) glclear(gl_color_buffer_bit); //clear screen // Shell glcolor3f(0.333, 0.420, 0.184); glvertex2i(80, 250); glvertex2i(100, 230); glvertex2i(160, 195); glvertex2i(205, 170); glvertex2i(270, 160); glvertex2i(510, 160); glvertex2i(590, 205); glvertex2i(590, 295); glvertex2i(570, 315); glvertex2i(540, 360); glvertex2i(450, 415); glvertex2i(400, 430); glvertex2i(325, 430); glvertex2i(235, 410);
10 glvertex2i(180, 355); glvertex2i(155, 320); glvertex2i(125, 300); glvertex2i(80, 250); // BackFoot glcolor3f(0.604, 0.804, 0.196); glvertex2i(205, 170); glvertex2i(220, 130); glvertex2i(280, 135); glvertex2i(270, 160); glvertex2i(205, 170); // BackToe glcolor3f(0.333, 0.420, 0.184); glvertex2i(220, 130); glvertex2i(235, 110); glvertex2i(270, 110); glvertex2i(280, 120); glvertex2i(280, 135); glvertex2i(220, 130); // FrontFoot glcolor3f(0.604, 0.804, 0.196); glvertex2i(590, 205); glvertex2i(510, 160); glvertex2i(500, 150); glvertex2i(530, 110); glvertex2i(610, 160); glvertex2i(610, 180); glvertex2i(590, 205); // FrontToe
11 glcolor3f(0.333, 0.420, 0.184); glvertex2i(500, 150); glvertex2i(465, 100); glvertex2i(515, 100); glvertex2i(530, 110); glvertex2i(500, 150); // Head glcolor3f(0.604, 0.804, 0.196); glvertex2i(590, 205); glvertex2i(680, 250); glvertex2i(705, 220); glvertex2i(705, 230); glvertex2i(680, 280); glvertex2i(590, 295); glvertex2i(590, 205); // Face Triangle glcolor3f(0.333, 0.420, 0.184); glbegin(gl_triangles); glvertex2i(660, 250); glvertex2i(600, 205); glvertex2i(640, 205); glvertex2i(660, 250); // Eye glcolor3f(0.678, 1, 0.184); glvertex2i(680, 250); glvertex2i(660, 250); glvertex2i(650, 270); glvertex2i(680, 270); glvertex2i(680, 250);
12 // Pupil glcolor3f(0.333, 0.420, 0.184); glvertex2i(665, 260); glvertex2i(670, 260); glvertex2i(670, 265); glvertex2i(665, 265); glvertex2i(665, 260); glpointsize(16.0); glcolor3f(0.678, 1, 0.184); glvertex2i(125, 300); glvertex2i(140, 270); glvertex2i(185, 245); glvertex2i(220, 240); glvertex2i(230, 230); glvertex2i(255, 220); glvertex2i(280, 240); glvertex2i(310, 215); glvertex2i(345, 235); glvertex2i(380, 220); glvertex2i(440, 235); glvertex2i(460, 220); glvertex2i(505, 215); glvertex2i(530, 230); glvertex2i(590, 205); glpointsize(32.0); glcolor3f(0.678, 1, 0.184); glvertex2i(180, 355); glvertex2i(240, 340); glvertex2i(290, 350); glvertex2i(350, 345); glvertex2i(435, 345);
13 glvertex2i(490, 345); glvertex2i(550, 260); glvertex2i(590, 240); glvertex2i(180, 355); glvertex2i(140, 270); glvertex2i(100, 230); glvertex2i(325, 430); glvertex2i(300, 400); glvertex2i(290, 350); glvertex2i(235, 410); glvertex2i(300, 400); glvertex2i(400, 430); glvertex2i(435, 345); glvertex2i(440, 235); glvertex2i(540, 360); glvertex2i(490, 345);
14 glvertex2i(570, 315); glvertex2i(550, 260); glvertex2i(530, 230); glvertex2i(590, 205); glvertex2i(350, 345); glvertex2i(345, 235); glvertex2i(240, 340); glvertex2i(220, 240); glvertex2i(160, 195); glvertex2i(180, 245); glvertex2i(230, 230); glvertex2i(205, 170); glvertex2i(255, 220); glvertex2i(270, 160); glvertex2i(310, 215); glvertex2i(325, 160);
15 glvertex2i(380, 220); glvertex2i(380, 160); glvertex2i(460, 220); glvertex2i(440, 160); glvertex2i(505, 215); glvertex2i(510, 155); glflush(); //send all output to screen //initialization void init(void); //does the drawing void display(void); /* Main Loop * Open window with initial window size, title bar, * RGB display mode, depth buffer. */ int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode(glut_single GLUT_RGB); //set display mode: single bufferring, RGBA model glutinitwindowsize(500, 500); //set window size on screen glutinitwindowposition(300, 100); //set window position on screen glutcreatewindow("cse-420: Homework 1, Turtle");
16 //open screen window init(); glutdisplayfunc(display); function glutmainloop(); return 0; //points to display //go into perpetual loop
17 Problem 4: Geometric Cubes #include <GL/glut.h> #include <math.h> #include <stdio.h> //initialization void init(void) glclearcolor(1, 1, 1, 0); glcolor3f(0.0f, 0.0f, 0.0f); //set drawing color glpointsize(4.0); //a dot is 4x4 glmatrixmode(gl_projection); glloadidentity(); //replace current matrix with identity matrix gluortho2d(-100, , 0, ); void display(void) glclear(gl_color_buffer_bit); //clear screen glcolor3f(0.0, 0.0, 1.0); // Points glvertex2i(20, 860); // 1 glvertex2i(20, 500); // 2 glvertex2i(280, 360); // 3 glvertex2i(490, 490); // 4 glvertex2i(490, 690); // 5 glvertex2i(360, 760); // 6 glvertex2i(270, 710); // 7 glvertex2i(270, 650); // 8 glvertex2i(700, 410); // 9 glvertex2i(1090, 630); // 10 glvertex2i(1090, 1030); // 11 glvertex2i(780, 1200); // 12 glvertex2i(530, 1060); // 13 glvertex2i(530, 800); // 14 glvertex2i(700, 710); // 15
18 glvertex2i(830, 780); // 16 glvertex2i(830, 880); // 17 glvertex2i(790, 910); // 18 glvertex2i(360, 670); // 19 glvertex2i(360, 200); // 20 glvertex2i(700, 20); // 21 glvertex2i(1000, 190); // 22 glvertex2i(1000, 490); // 23 glvertex2i(790, 610); // 24 glvertex2i(620, 520); // 25 glvertex2i(620, 350); // 26 glvertex2i(700, 310); // 27 glvertex2i(740, 340); // 28 glvertex2i(740, 840); // 29 glvertex2i(360, 1060); // 30 glvertex2i(20, 860); glflush(); //send all output to screen //initialization void init(void); //does the drawing void display(void); /* Main Loop * Open window with initial window size, title bar, * RGB display mode, depth buffer. */ int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode(glut_single GLUT_RGB); //set display mode: single bufferring, RGBA model glutinitwindowsize(500, 500); //set window size on screen glutinitwindowposition(300, 100); //set window position on screen glutcreatewindow("cse-420: Homework 1, Geometric Cubes");
19 //open screen window init(); glutdisplayfunc(display); function glutmainloop(); return 0; //points to display //go into perpetual loop
20 Problem 3: Hexagons #include <GL/glut.h> #include <math.h> #include <stdio.h> //initialization void init(void) glclearcolor(1, 1, 1, 0); glcolor3f(0.0f, 0.0f, 0.0f); //set drawing color glpointsize(4.0); //a dot is 4x4 glmatrixmode(gl_projection); glloadidentity(); //replace current matrix with identity matrix gluortho2d(-500, 500.0, -500, 500.0); void display(void) glclear(gl_color_buffer_bit); //clear screen float pos[] = -1.0, 1.0, -2.0, 1.0 ; gllightfv(gl_light0, GL_POSITION, pos); gldisable(gl_lighting); //Top Hexagon: Yellow //draw points glcolor3f(1.0, 1.0, 0.0); glvertex2i(0, 450); // Vert 1: Top Vert glvertex2i(100, 400); // Vert 2: x + 100, y - 50 glvertex2i(100, 300); // Vert 3: x, y - 100; glvertex2i(0, 250); // Vert 4: x - 100, y - 50 glvertex2i(-100, 300); // Vert 5: x - 100, y + 50 glvertex2i(-100, 400); // Vert 6: x, y glvertex2i(0, 450); // Vert 7: Back to First Vert //Right-Top Hexagon: Red glcolor3f(1.0, 0.0, 0.0); //draw points
21 glvertex2i(200, 150); glvertex2i(100, 100); glvertex2i(100, 300); glvertex2i(200, 350); glvertex2i(300, 300); glvertex2i(300, 200); glvertex2i(200, 150); // Vert 1: Bottom Vert // Vert 2: Botton Left // Vert 3: Top Left // Vert 4: Top // Vert 5: Top Right // Vert 6: Bottom Right // Vert 7: Bottom Vert //Right-top Hexagon: Red //draw points glcolor3f(1.0, 0.0, 0.0); glvertex2i(-200, 150); // Vert 1: Bottom Vert glvertex2i(-100, 100); // Vert 2: Botton Left glvertex2i(-100, 300); // Vert 3: Top Left glvertex2i(-200, 350); // Vert 4: Top glvertex2i(-300, 300); // Vert 5: Top Right glvertex2i(-300, 200); // Vert 6: Bottom Right glvertex2i(-200, 150); // Vert 7: Bottom Vert //Right-Bottom Hexagon: Yellow //draw points glcolor3f(1.0, 1.0, 0.0); glvertex2i(200, -50); // Vert 1: Bottom Vert glvertex2i(100, 0); // Vert 2: Botton Left glvertex2i(100, 200); // Vert 3: Top Left glvertex2i(200, 150); // Vert 4: Top glvertex2i(300, 100); // Vert 5: Top Right glvertex2i(300, 0); // Vert 6: Bottom Right glvertex2i(200, -50); // Vert 7: Bottom Vert //Left-Bottom Hexagon: Yellow //draw points glcolor3f(1.0, 1.0, 0.0); glvertex2i(-200, -50); // Vert 1: Bottom Vert glvertex2i(-100, 0); // Vert 2: Botton Left glvertex2i(-100, 200); // Vert 3: Top Left glvertex2i(-200, 150); // Vert 4: Top
22 glvertex2i(-300, 100); glvertex2i(-300, 0); glvertex2i(-200, -50); // Vert 5: Top Right // Vert 6: Bottom Right // Vert 7: Bottom Vert //Middle Hexagon: Blue //draw points glcolor3f(0.0, 0.0, 1.0); glvertex2i(0, 250); // Vert 1: Top Vert glvertex2i(100, 200); // Vert 2: x + 100, y - 50 glvertex2i(100, 100); // Vert 3: x, y - 100; glvertex2i(0, 50); // Vert 4: x - 100, y - 50 glvertex2i(-100, 100); // Vert 5: x - 100, y + 50 glvertex2i(-100, 200); // Vert 6: x, y glvertex2i(0, 250); // Vert 7: Back to First Vert //Bottom Hexagon: Red //draw points glcolor3f(1.0, 0.0, 0.0); glvertex2i(0, 50); // Vert 1: Top Vert glvertex2i(100, 0); // Vert 2: x + 100, y - 50 glvertex2i(100, -100); // Vert 3: x, y - 100; glvertex2i(0, -150); // Vert 4: x - 100, y - 50 glvertex2i(-100, -100); // Vert 5: x - 100, y + 50 glvertex2i(-100, 0); // Vert 6: x, y glvertex2i(0, 50); // Vert 7: Back to First Vert // TRIANGLES///////////////////////////// // Top-right Triangle: Green glbegin(gl_triangles); //draw points glcolor3f(0.0, 1.0, 0.0); glvertex2i(100, 300); glvertex2i(100, 200); glvertex2i(0, 250); glvertex2i(100, 300);
23 // Top-left Triangle: Green glbegin(gl_triangles); glcolor3f(0.0, 1.0, 0.0); glvertex2i(100, 300); glvertex2i(100, 200); glvertex2i(0, 250); glvertex2i(100, 300); // Top-left Triangle: Green glbegin(gl_triangles); glcolor3f(0.0, 1.0, 0.0); glvertex2i(-100, 300); glvertex2i(-100, 200); glvertex2i(0, 250); glvertex2i(-100, 300); //draw points //draw points // Botton-right Triangle: Green glbegin(gl_triangles); //draw points glcolor3f(0.0, 1.0, 0.0); glvertex2i(100, 100); glvertex2i(100, 0); glvertex2i(0, 50); glvertex2i(100, 100); // Botton-left Triangle: Green glbegin(gl_triangles); //draw points glcolor3f(0.0, 1.0, 0.0); glvertex2i(-100, 100); glvertex2i(-100, 0); glvertex2i(0, 50); glvertex2i(-100, 100); // Triangle Right glbegin(gl_triangles); glcolor3f(0.0, 1.0, 0.0); glvertex2i(100, 200); //draw points
24 glvertex2i(100, 100); glvertex2i(200, 150); glvertex2i(100, 200); // Triangle Left glbegin(gl_triangles); glcolor3f(0.0, 1.0, 0.0); glvertex2i(-100, 100); glvertex2i(-100, 200); glvertex2i(-200, 150); glvertex2i(-100, 200); glflush(); //send all output to screen //initialization void init(void); //does the drawing void display(void); /* Main Loop * Open window with initial window size, title bar, * RGB display mode, depth buffer. */ int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode(glut_single GLUT_RGB); //set display mode: single bufferring, RGBA model glutinitwindowsize(500, 500); //set window size on screen glutinitwindowposition(300, 100); //set window position on screen glutcreatewindow("cse-420: Homework 1, Hexagons"); //open screen window init(); glutdisplayfunc(display); //points to display function
25 glutmainloop(); return 0; //go into perpetual loop
6. 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationCS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008
CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation
More informationUNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M
UNIT 7 LIGHTING AND SHADING 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M Ans: Phong developed a simple model that can be computed rapidly It considers three
More 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationCOS340A Assignment 1 I Pillemer Student# March 25 th 2007 p1/15
COS340A Assignment 1 I Pillemer Student# 3257 495 9 March 25 th 2007 p1/15 Assignment 1 I Pillemer Student#: 3257 495 9 COS340A Date submitted: March 25, 2007 Question 1... p2 3 Question 2... p4 Question
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 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 informationOpenGL JOGL. OpenGL & JOGL. Shaoting Zhang, or Tony. September 12, 2007
September 12, 2007 1 Program 2 HW: Graphing in I m Program Cross-language (C, C++, C#, Java, Python, Delphi) Cross-platform (Linux, Windows, Unix, PS3) Low-level (provides only rendering func.) State machine
More informationGraphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:
Graphics Programming Chapter 2 Introduction: - Our approach is programming oriented. - Therefore, we are going to introduce you to a simple but informative problem: the Sierpinski Gasket - The functionality
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 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 information11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)
CSCI 420 Computer Graphics Lecture 2 Basic Graphics Programming Teaching Assistant Yijing Li Office hours TBA Jernej Barbic University of Southern California Graphics Pipeline OpenGL API Primitives: Lines,
More information1/12/11. Basic Graphics Programming. What is OpenGL. OpenGL is cross-platform. How does OpenGL work. How does OpenGL work (continued) The result
CSCI 480 Computer raphics Lecture 2 asic raphics Programming What is OpenL A low- level graphics API for 2D and 3D interac
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 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 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 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 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 informationDisplay Lists in OpenGL
Display Lists in OpenGL Display lists are a mechanism for improving performance of interactive OpenGL applications. A display list is a group of OpenGL commands that have been stored for later execution.
More informationComputer Graphics 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 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 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 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 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 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 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 information1.2 Basic Graphics Programming
Fall 2018 CSCI 420: Computer Graphics 1.2 Basic Graphics Programming Hao Li http://cs420.hao-li.com 1 Last time Last Time Story Computer Graphics Image Last Time 3D Printing 3D Capture Animation Modeling
More informationOpenGL Introduction Computer Graphics and Visualization
Fall 2009 2 OpenGL OpenGL System Interaction Portable Consistent visual display regardless of hardware, OS and windowing system Callable from Ada, C, C++, Fortran, Python, Perl and Java Runs on all major
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 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 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 informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller
More 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 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 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 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 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 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 information... Print PROGRAMS\Final Project final\planes\planeshoot.c 1
... Print PROGRAMS\Final Project final\planes\planeshoot.c 1 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include
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 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 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 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 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 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 informationCS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008
CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008 2008/2/3 Slide 2 I Am Your TA Name : Wei-Wen Wen Feng 4th Year Graduate Student in Graphics I will be Holding discussion/tutorial
More informationIntroduction to MS Visual C/C++
3/4/2002 Burkhard Wünsche Introduction to C/C++ Page 1 of 9 0. Introduction: Introduction to MS Visual C/C++ This tutorial gives a simple introduction to MS Visual C/C++ with an emphasis on OpenGL graphics
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 information20 GLuint objects; 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN:
1 1. 1 #include 2 #include 3 Program 1 (OpenGL Sample016) 4 // 5 static int MouseX = 0; // X 6 static int MouseY = 0; // Y 7 static float SpinX = 0; // X 8 static float SpinY = 0;
More 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 informationOverview of Graphics Systems Hearn & Baker Chapter 2. Some slides are taken from Robert Thomsons notes.
Overview of Graphics Systems Hearn & Baker Chapter 2 Some slides are taken from Robert Thomsons notes. OVERVIEW Video Display Devices Raster Scan Systems Graphics Workstations and Viewing Systems Input
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 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 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 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 informationCOMP 371/4 Computer Graphics Week 1
COMP 371/4 Computer Graphics Week 1 Course Overview Introduction to Computer Graphics: Definition, History, Graphics Pipeline, and Starting Your First OpenGL Program Ack: Slides from Prof. Fevens, Concordia
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 informationComp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program
Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most
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 informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology Tracing Photons One way to form an image is to follow rays of light from a point source finding which rays enter the lens
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 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 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 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 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 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 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 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 information1 /* 4 C:\opencv\build\include. 6 C:\opencv\build\x86\vc10\lib
1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib
More information