Andrew Yenalavitch Homework 1 CSE Fall 2014

Size: px
Start display at page:

Download "Andrew Yenalavitch Homework 1 CSE Fall 2014"

Transcription

1 Andrew Yenalavitch Homework 1 CSE Fall ) ( 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 include the case m > 1. Implement the algorithm for all the cases of m 1 and m > 1. Test your program by drawing the following lines a.) from ( 20, 20 ) to ( 300, 60 ) b.) from ( 20, 20 ) to ( 60, 300 ) c.) from ( 20, 20 ) to ( 300, -60 ) d.) from ( 20, 20 ) to ( -300, 60 ) I used a series of if statements to swap values before plotting depending on the slope and direction of the input. Here is the output for: a) (20,20) to (300,60)

2 b) (20,20) to (60,300) c) (20,20) to (300, -60)

3 d) (20,20) to (-300,60) Source code: #include <GL/glut.h> #include <stdio.h> #include <math.h> void init(void) glclearcolor(1.0,1.0,1.0,0.0); glmatrixmode(gl_projection); gluortho2d(-500.0,500.0,-500.0,500.0); void setpixel(glint x,glint y) glbegin(gl_points); glvertex2i(x,y); void line() int x0 = 20, y0 = 20, xn = -300, yn = 60, x, y; int dx, dy, //deltas pk, //decision parameter k; //looping variable glclear(gl_color_buffer_bit); glcolor3f( 0, 0, 0); setpixel(x0, y0); //plot first point

4 // difference between starting and ending points dx = xn - x0; dy = yn - y0; double m = dy/dx; x = x0; y = y0; pk = 2 * dy - dx; if ( m < 0 ) dy = -dy; for ( k = 0; k < dx+1; ++k ) if ( pk < 0 ) pk = pk + 2 * dy; else pk = pk + 2*dy - 2*dx; --y; ++x; setpixel( x, y ); if ( m > 1 ) dx = yn - y0; dy = xn - x0; x = y0; y = x0; for ( k = 0; k < dx-1; ++k ) if ( pk < 0 ) pk = pk + 2 * dy; else pk = pk + 2*dy - 2*dx; ++y; ++x; setpixel( y, x ); if ( (m <= 1 && m >= 0) && (xn > 0)) for ( k = 0; k < dx-1; ++k ) if ( pk < 0 ) pk = pk + 2 * dy; else pk = pk + 2*dy - 2*dx; ++y; ++x;

5 setpixel( x, y ); if ( (m <= 1 && m >= 0) && (xn < 0) ) dx = -dx; pk = 2 * dy - dx; for ( k = 0; k > -dx+1; --k ) if ( pk < 0 ) pk = pk + 2 * dy; else pk = pk + 2*dy - 2*dx; ++y; --x; setpixel( x, y ); glflush(); int main(int argc,char **argv) glutinit(&argc,argv); glutinitdisplaymode(glut_single GLUT_RGB); glutinitwindowposition(0,0); glutinitwindowsize(500,500); glutcreatewindow("blinemod"); init(); glutdisplayfunc( line ); glutmainloop(); return 0; 2.) ( 10 points ) Use OpenGL to draw a dot plot of the function f(x) = e - x sin ( 2πx ), 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. I used OpenGL to create a modified version of the plots program. It scales the function to fill the window based on inputs xlow and xhigh. Here are screenshots of 3 different combinations of xlow and xhigh.

6 xlow = 0 and xhigh = 4 xlow = -4 and xhigh = 4 xlow = 0 and xhigh = 10 Source code: #include <GL/glut.h> #include <stdio.h> #include <math.h> using namespace std; const int screenwidth = 640; const int screenheight = 480; // width of the screen window in pixels // height of the screen window in pixels

7 void init(void) glclearcolor(1.0,1.0,1.0,0.0); // the background color is white glcolor3f(0.0f, 0.0f, 0.0f); // the drawing color is black glpointsize(2.0); // a 'dot' is 2 by 2 pixels glmatrixmode(gl_projection); glloadidentity(); gluortho2d(0.0, screenwidth, 0.0, screenheight); double f ( double x ) double y = exp(-abs(x)) * sin(2 * * x); return y; void mysine(void) glclear(gl_color_buffer_bit); double A, B, C, D, x, y, xlow, xhigh; int sx, sy; xlow = 0; xhigh = 10; A = screenwidth / (xhigh - xlow); B = A * abs(xlow); C = -screenheight / 2; D = screenheight / 2; glbegin(gl_points); for(x = xlow; x < xhigh ; x += 0.001) y = f(x); sx = (int) ( A * x + B ); sy = (int) ( C * y + D ); glvertex2i(sx, sy); glflush(); // send all output to display int main(int argc,char **argv) glutinit(&argc,argv); glutinitdisplaymode(glut_single GLUT_RGB); glutinitwindowposition(0,0); glutinitwindowsize(500,500); glutcreatewindow("mysine"); init(); glutdisplayfunc( mysine ); glutmainloop(); return 0;

8 3.) ( 10 points )Use SDL and the Surface class supplied in the web site to draw a line passing through the center of the screen. Animate the rotation of the line about the center for several rounds. ( Note that a user at any instance only sees a single line on the screen. ) I used SDL_Delay() and surf.clearscreen() to clear lines in set intervals, simulating a spinning line. Source code: // spinline.cpp #include <SDL/SDL.h> #include <stdlib.h>

9 #include <stdio.h> #include "draw.h" #include "surface.h" //draw a spinning line void spinline ( Surface &surf, int x, int y ) surf.moveto( x - 200, y ); surf.lineto( x + 200, y ); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x - 175, y - 100); surf.lineto( x + 175, y + 100); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x - 100, y ); surf.lineto( x + 100, y ); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x, y - 200); surf.lineto( x, y + 200); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x + 100, y ); surf.lineto( x - 100, y ); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x + 175, y ); surf.lineto( x - 175, y + 100); SDL_Delay ( 1000 ); surf.clearscreen(); surf.moveto( x + 200, y ); surf.lineto( x - 200, y ); SDL_Delay ( 1000 ); surf.clearscreen();

10 int main() const int VWIDTH = 640; const int VHEIGHT = 480; const Point center ( VWIDTH/2, VHEIGHT/2 ); //center of screen Surface surf( VWIDTH, VHEIGHT, (char *) "Spinning Line" ); surf.setbackgroundcolor ( 0xff, 0xff, 0xff ); //set background to white surf.setcolor ( 0, 0, 0 ); spinline ( surf, center.x, center.y ); return 1; //using black drawing color 4.) Use turtle graphics or/and other means to reproduce any five of the following images ( extra credit for extra reproduction ). The images on the homework page are really low resolution, which makes it hard see some shapes, but I feel I made all 5 correctly. Image 1) I did some research into the recursive Dragon curve algorithm and created this using turtle graphics via the Canvas class: Source code: #include "canvas.h" Canvas cvs ( 500, 500, "Dragon" ); void dragon( int n )

11 if (n == 0) cvs.forward(.2,1); else dragon (n-1); cvs.turn(-90); for (int i = n - 2; i >= 0; i--) dragon(i); cvs.turn(90); cvs.forward(.2,1); void display(void) cvs.clearscreen(); cvs.setbackgroundcolor(0, 0, 0); cvs.setcolor(1.0, 0.5, 0); cvs.moveto(-2.0, 0.0); cvs.turnto ( 90.0 ); dragon ( 10 ); Image 2) I created the seven hexagon/six triangle image using OpenGl: Source code: #include <GL/glut.h> //initialization void init( void ) glclearcolor( 1.0, 1.0, 1.0, 0.0 ); //get white background color glcolor3f( 0.0f, 1.0f, 0.0f ); //set drawing color glpointsize( 4.0 ); //a dot is 4x4 glmatrixmode( GL_PROJECTION ); glloadidentity(); //replace current matrix with identity matrix gluortho2d( 0.0, 500.0, 0.0, );

12 void display( void ) int x=200, y=200; glclear( GL_COLOR_BUFFER_BIT ); // clear screen glpolygonmode( GL_FRONT, GL_FILL ); //Here are the 7 hexagons // Middle hexagon glcolor3f ( 0.0, 0.0, 1.0 ); // Blue glbegin( GL_POLYGON ); glvertex2i( x + 50, y ); glvertex2i( x, y + 75 ); glvertex2i( x, y + 25); glvertex2i( x + 50, y ); glvertex2i( x + 100, y + 25); glvertex2i( x + 100, y + 75); // Top middle hexagon glcolor3f ( 1.0, 1.0, 0.0 ); // Yellow glbegin( GL_POLYGON ); glvertex2i( x + 50, y ); glvertex2i( x, y ); glvertex2i( x, y + 125); glvertex2i( x + 50, y + 100); glvertex2i( x + 100, y + 125); glvertex2i( x + 100, y + 175); // Bottom middle hexagon glcolor3f ( 1.0, 0.0, 0.0 ); // Red glbegin( GL_POLYGON ); glvertex2i( x + 50, y ); glvertex2i( x, y - 25 ); glvertex2i( x, y - 75); glvertex2i( x + 50, y - 100); glvertex2i( x + 100, y - 75); glvertex2i( x + 100, y - 25); // Upper right hexagon glcolor3f ( 1.0, 0.0, 0.0 ); // Red glbegin( GL_POLYGON ); glvertex2i( x + 100, y + 125); glvertex2i( x + 100, y + 75); glvertex2i( x + 150, y + 50);

13 glvertex2i( x + 150, y + 150); glvertex2i( x + 200, y + 75); glvertex2i( x + 200, y + 125); // Lower right hexagon glcolor3f ( 1.0, 1.0, 0.0 ); glbegin( GL_POLYGON ); glvertex2i( x + 100, y + 25); glvertex2i( x + 100, y - 25); glvertex2i( x + 150, y - 50); glvertex2i( x + 200, y - 25); glvertex2i( x + 200, y + 25); glvertex2i( x + 150, y + 50); // Yellow // Upper left hexagon glcolor3f ( 1.0, 0.0, 0.0 ); // Red glbegin( GL_POLYGON ); glvertex2i( x, y + 125); glvertex2i( x, y + 75); glvertex2i( x - 50, y + 50); glvertex2i( x - 100, y + 75); glvertex2i( x - 100, y + 125); glvertex2i( x - 50, y + 150); // Lower left hexagon glcolor3f ( 1.0, 1.0, 0.0 ); glbegin( GL_POLYGON ); glvertex2i( x, y + 25); glvertex2i( x, y - 25); glvertex2i( x - 50, y - 50); glvertex2i( x - 100, y - 25); glvertex2i( x - 100, y + 25); glvertex2i( x - 50, y + 50); // Yellow // Here are the six green triangles glcolor3f ( 0.0, 1.0, 0.0 ); glbegin( GL_TRIANGLES ); glvertex2i( x, y + 25); glvertex2i( x, y - 25); glvertex2i( x + 50, y); // Green glbegin( GL_TRIANGLES ); glvertex2i( x, y + 25); glvertex2i( x, y + 75); glvertex2i( x - 50, y + 50);

14 glbegin( GL_TRIANGLES ); glvertex2i( x, y + 125); glvertex2i( x, y + 75); glvertex2i( x + 50, y + 100); glbegin( GL_TRIANGLES ); glvertex2i( x + 50, y + 100); glvertex2i( x + 100, y + 75); glvertex2i( x + 100, y + 125); glbegin( GL_TRIANGLES ); glvertex2i( x + 100, y + 75); glvertex2i( x + 100, y + 25); glvertex2i( x + 150, y + 50); glbegin( GL_TRIANGLES ); glvertex2i( x + 100, y + 25); glvertex2i( x + 100, y - 25); glvertex2i( x + 50, y); glflush(); //send all output to screen Image 3) I created the trispiral configuration using the Canvas class. There are 3 spirals and each spiral has sides that increase in length with every turn: #include "canvas.h" Canvas cvs ( 500, 500, "trispiral" );

15 //draw a trispiral pattern void drawtrispiral ( float sidelength ) for (int i = 0; i < 3; i++) // Number of spirals cvs.forward( sidelength *.5, 1 ); cvs.turn(300); for (int j = 1; j < 10; j++) cvs.forward( sidelength * j, 1 ); cvs.turn(300); void display(void) cvs.clearscreen(); cvs.setbackgroundcolor(1, 1, 1); cvs.setcolor(0, 0, 0); cvs.moveto(0, 0); cvs.turnto ( 90 ); drawtrispiral(.5 ); Image 4)For this image I created the 5 figures using the Surface class Source code: #include <SDL/SDL.h> #include <stdlib.h> #include <stdio.h> #include "draw.h" #include "surface.h" //draw a star pattern void draw_star( Surface &surf, int L )

16 for ( int i = 0; i < 5; ++i ) surf.forward( L, 1 ); surf.turn( 144 ); //draw a wheel void draw_wheel ( Surface &surf, int n, int radius, float rotangle, Point wcenter) if ( n < 5 ) return; //bad number of sides int cx = surf.getcp().x; int cy = surf.getcp().y; Point pointarray[n]; double angle = rotangle * / 180; //initial angle double angleinc = 2 * / n; //angle increment surf.moveto ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int k = 0; k < n; k++ ) //repeat n times angle += angleinc; Point temp (( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); surf.lineto ( temp ); pointarray[k] = temp; for (int i = 0; i < n; i++) surf.moveto (wcenter); surf.lineto (pointarray[i]); //draw an n-sided regular polygon void draw_polygon ( Surface &surf, int n, int radius, float rotangle ) if ( n < 3 ) return; //bad number of sides int cx = surf.getcp().x; int cy = surf.getcp().y; double angle = rotangle * / 180; //initial angle double angleinc = 2 * / n; //angle increment surf.moveto ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int k = 0; k < n; k++ ) //repeat n times angle += angleinc; surf.lineto ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); //draw_polygon //draw rosette with N-sided polygon void rosette (Surface &surf, int N, int radius )

17 if ( N < 3 ) return; Point pt[n+1]; int cx = surf.getcp().x; int cy = surf.getcp().y; double angle = 0; //initial angle double angleinc = 2 * / N; //angle increment pt[0] = Point ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int k = 1; k < N; k++ ) //repeat n times angle += angleinc; pt[k] = Point ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int i = 0; i < N - 1; i++ ) for ( int j = i + 1; j < N; j++ ) surf.moveto ( pt[i] ); //connect all vertices //rosette int main() surf.lineto ( pt[j] ); #ifndef ARM const int VWIDTH = 640; const int VHEIGHT = 480; #else const int VWIDTH = 320; const int VHEIGHT = 240; #endif const Point center ( VWIDTH/2, VHEIGHT/2 ); //center of screen Surface surf( VWIDTH, VHEIGHT, (char *) "Draw_demo" ); surf.clearscreen(); SDL_Delay ( 1000 ); //clear screen //dealy one second, just for demo surf.setbackgroundcolor ( 0xff, 0xff, 0xff ); //set background to white surf.setcolor ( 0, 0, 0 ); //black //draw a star surf.moveto ( center.x - 100, center.y - 70 ); surf.turnto ( 0 ); draw_star ( surf, 100 ); //draw nested stars Point p1 ( center.x + 100, center.y - 60 ); surf.moveto ( p1 );

18 surf.turnto ( 0 ); for (int i = 99; i > 0; i-=33) int x = p1.x + 16; int y = p1.y - 5; p1.set(x,y); surf.moveto ( p1 ); draw_star ( surf, i ); //draw an pentagon surf.moveto ( center.x - 220, center.y - 70 ); draw_polygon ( surf, 5, 60, 55 ); //draw a wheel Point wcenter ( center.x - 200, center.y ); surf.moveto ( wcenter ); draw_wheel ( surf, 15, 100, 0, wcenter ); //draw an 20-sided rosette surf.setcolor ( 0, 0, 0 ); surf.moveto ( center.x + 90, center.y ); rosette ( surf, 20, 100 ); SDL_Delay ( 5000 ); return 1; Image 5) For this image I used the Surface class as in the above image: Source code: #include <SDL/SDL.h> #include <stdlib.h> #include <stdio.h> #include "draw.h" #include "surface.h"

19 void draw_frect( Surface surf, int L) int temp = L; for ( int i = 0; i < L; ++i ) surf.forward( temp, 1 ); surf.turn( 90 ); --temp; void draw_rect( Surface surf, int W, int H) surf.forward( W, 1 ); surf.turn( 90 ); surf.forward( H, 1 ); surf.turn( 90 ); surf.forward( W, 1 ); surf.turn( 90 ); surf.forward( H, 1 ); surf.turn( 90 ); void draw_arc ( Surface &surf, int n, int radius, float rotangle ) if ( n < 3 ) return; //bad number of sides int cx = surf.getcp().x; int cy = surf.getcp().y; double angle = rotangle * / 180; //initial angle double angleinc = 2 * / n; //angle increment surf.moveto ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int k = 0; k < 2 * n / 3; k++ ) //repeat n times angle += angleinc; surf.lineto ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); //draw rosette with N-sided polygon void rosette (Surface &surf, int N, int radius ) if ( N < 3 ) return; Point pt[n+1]; int cx = surf.getcp().x; int cy = surf.getcp().y; double angle = 0; //initial angle double angleinc = 2 * / N; //angle increment pt[0] = Point ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int k = 1; k < N; k++ ) //repeat n times

20 angle += angleinc; pt[k] = Point ( ( int) (radius * cos( angle ) + cx), ( int ) ( radius * sin ( angle ) + cy ) ); for ( int i = 0; i < N - 1; i++ ) for ( int j = i + 1; j < N; j++ ) surf.moveto ( pt[i] ); //connect all vertices //rosette int main() surf.lineto ( pt[j] ); #ifndef ARM const int VWIDTH = 640; const int VHEIGHT = 480; #else const int VWIDTH = 320; const int VHEIGHT = 240; #endif const Point center ( VWIDTH/2, VHEIGHT/2 ); //center of screen Surface surf( VWIDTH, VHEIGHT, (char *) "Draw_demo" ); surf.clearscreen(); SDL_Delay ( 1000 ); //clear screen //dealy one second, just for demo surf.setbackgroundcolor ( 0xff, 0xff, 0xff ); //set background to white //draw a 17-sided rosette surf.setcolor ( 0xff, 0, 0 ); surf.moveto ( center.x + 90, center.y ); rosette ( surf, 17, 100 ); //draw an arc (2/3 of a circle) surf.setcolor ( 0, 0, 0 ); surf.moveto ( center.x + 40, center.y ); draw_arc ( surf, 40, 230, -85 ); //red //black //draw filled rectangle surf.setcolor ( 0, 0xff, 0 ); //green surf.moveto ( center.x - 270, center.y + 90 ); surf.turnto(0); draw_frect ( surf, 170 ); //draw an empty square (overwrites lines of rectangle that overlap) surf.setcolor ( 0, 0xff, 0 ); //green surf.moveto ( center.x - 250, center.y - 60 );

21 draw_rect ( surf, 65, 75 ); SDL_Delay ( 3000 ); return 1; Evaluation: This was one of the most time-consuming homework assignments I've ever done. I feel 5 images is too large a number. Having said that, I feel I successfully completed all parts of the homework assignment and am giving myself 60 points.

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1

Duc 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 information

6. Make use of glviewport() to display two sine curves on the same screen, one on the

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 information

by modifying the glutinitwindowsize() function you can change the screen size to whatever you please.

by 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 information

COMPUTER GRAPHICS LAB # 3

COMPUTER 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 information

Assignment 1. Simple Graphics program using OpenGL

Assignment 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 information

Lecture 3. Understanding of OPenGL programming

Lecture 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 information

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Computer 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 information

Source code: #include <iostream>

Source 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 information

PART-I: Lab for MCS-051 (Advanced Internet Technologies)

PART-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 information

CS621 Lab 1 Name: Ihab Zbib

CS621 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 information

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

Programming 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 information

Drawing Primitives. OpenGL basics

Drawing 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 information

UNIT 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 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 information

2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-

2. 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 information

Introduction to OpenGL: Part 2

Introduction 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 information

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

CS559: 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 information

Graphics Programming

Graphics 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 information

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

Graphics 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 information

Computer Graphics. OpenGL

Computer 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 information

Computer Graphics: Line Drawing Algorithms

Computer 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 information

COS340A Assignment 1 I Pillemer Student# March 25 th 2007 p1/15

COS340A 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 information

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

GL_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 information

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Lecture 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 information

Computer Graphics, Chapt 08

Computer 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

Introduction to Computer Graphics with OpenGL/GLUT

Introduction 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 information

CS 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 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

Announcements OpenGL. Computer Graphics. Autumn 2009 CS4815

Announcements 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 information

Basic Graphics Programming

Basic 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 information

Announcements OpenGL. Computer Graphics. Spring CS4815

Announcements 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 information

Computer Graphics Introduction to OpenGL

Computer 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 information

Precept 2 Aleksey Boyko February 18, 2011

Precept 2 Aleksey Boyko February 18, 2011 Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)

More information

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

C++ 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 information

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

Teacher 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 information

OpenGL JOGL. OpenGL & JOGL. Shaoting Zhang, or Tony. September 12, 2007

OpenGL 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 information

Bob s Concise Introduction to Doxygen

Bob 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 information

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

To 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 information

C OMPUTER G RAPHICS Thursday

C 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 information

Display Lists in OpenGL

Display 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 information

OpenGL/GLUT Intro. Week 1, Fri Jan 12

OpenGL/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 information

CS Computer Graphics: OpenGL, Continued

CS 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 information

CS Computer Graphics: OpenGL, Continued

CS 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 information

OpenGL for dummies hello.c #include int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (250, 250); glutinitwindowposition

More information

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

CS559: 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 information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code

More information

2 Transformations and Homogeneous Coordinates

2 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 information

Lectures OpenGL Introduction

Lectures 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 information

CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS 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 information

Programming with OpenGL Part 3: Three Dimensions

Programming 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 information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Comp 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 information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

CSE4030 Introduction to Computer Graphics

CSE4030 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 information

Using OpenGL with CUDA

Using 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 information

Windows and Viewports. Windows and Viewports. Windows and Viewports. Windows and Viewports. CSC 706 Computer Graphics

Windows 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

Computer Graphics (Basic OpenGL)

Computer 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 information

Programming using OpenGL: A first Introduction

Programming 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 information

Philip Calderon CSE 520 Lab 3 Color Shader

Philip 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 information

2a. The triangles scale increases (expands) when the 'e' key is pressed and decreases (contracts) when the 'c' key is pressed.

2a. 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 information

Erik Anchondo cse 520 lab 4

Erik 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 information

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Books, 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 information

Overview 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 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 information

Graphics and Visualization

Graphics 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 information

Computer Graphics Primitive Attributes

Computer 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 information

Programming with OpenGL Part 1: Background

Programming 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 information

CMSC 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 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 information

Basic Graphics Programming

Basic 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 information

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)

11/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 information

CS380: Computer Graphics Basic OpenGL Structure. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS380: 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 information

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1)

Computer 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 information

Introduction to OpenGL

Introduction 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 information

ignoumcaassignmentsolution.blogspot.in By: Mr. Lokesh Chandra Singh

ignoumcaassignmentsolution.blogspot.in By: Mr. Lokesh Chandra Singh 1 P a g e ------------------ Course Code : MCS-053 Course Title : Computer Graphics and Multimedia Assignment Number : MCA (5)/053/Assign /2013 Maximum Marks : 100 Weightage : 25% Last Dates for Submission

More information

Lecture 4 of 41. Lab 1a: OpenGL Basics

Lecture 4 of 41. Lab 1a: OpenGL Basics Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor

More information

Computer Graphics 1 Computer Graphics 1

Computer 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 information

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Books, 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 information

FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4. C++ - OpenGL

FAKULTI 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 information

Chapter 13 Selection and Feedback

Chapter 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

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12 Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES

More information

CSC 706 Computer Graphics Turtle graphics Relative drawing

CSC 706 Computer Graphics Turtle graphics Relative drawing CSC 706 Computer Graphics Turtle graphics Relative drawing 1 Class Point2 class Point2 { public: Point2() {x = y = 0.0f;} // constructor1 Point2(float xx, float yy) {x = xx; y = yy;} // constructor2 void

More information

Introduction to MS Visual C/C++

Introduction 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 information

Computer Graphics and Image Processing Ray Tracing II. Additional material

Computer Graphics and Image Processing Ray Tracing II. Additional material Computer Graphics and Image Processing Ray Tracing II Additional material 1 Today s Outline 1. Structure of a Ray Tracer 2. Implementing a Ray Caster 3. Lights and Shadows 2 STRUCTURE OF A RAY TRACER 3

More information

1 (Practice 1) Introduction to OpenGL

1 (Practice 1) Introduction to OpenGL 1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,

More information

CS 4204 Computer Graphics

CS 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 information

Graphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:

Graphics 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 information

3D computer graphics: geometric modeling of objects in the computer and rendering them

3D 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 information

Introduction to OpenGL Week 1

Introduction 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 information

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

Objectives. 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 information

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms Chater : Grahics Outut Primitives Primitives: functions in grahics acage that we use to describe icture element Points and straight lines are the simlest rimitives Some acages include circles, conic sections,

More information

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Modeling 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 information

Computer Graphics Introduction to OpenGL

Computer 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 information

CS418 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 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 information

CS380: Computer Graphics 2D Imaging and Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS380: Computer Graphics 2D Imaging and Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL: CS380: Computer Graphics 2D Imaging and Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg Class Objectives Write down simple 2D transformation matrixes Understand the

More information

Lectures Display List

Lectures Display List Lectures Display List 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 it? What

More information

Computer Graphics Anatomy of GUI. Computer Graphics CSC470 1

Computer Graphics Anatomy of GUI. Computer Graphics CSC470 1 Computer Graphics Anatomy of GUI 1 Anatomy of GLUT keyboard mouse OpenGL Application if (key == f key == F ) { glutfullscreen(); } else if(key == w key == W ) { glutreshapewindow(640,480); } display reshape

More information

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling Hofstra University 1 Modeling complex objects/motion Decompose object hierarchically

More information

RECITATION - 1. Ceng477 Fall

RECITATION - 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 information

Order of Transformations

Order 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 information

Abel J. P. Gomes LAB. 1. INTRODUCTION TO OpenGL

Abel 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 information

Computer graphics MN1

Computer 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 information

Luiz Fernando Martha André Pereira

Luiz Fernando Martha André Pereira Computer Graphics for Engineering Numerical simulation in technical sciences Color / OpenGL Luiz Fernando Martha André Pereira Graz, Austria June 2014 To Remember Computer Graphics Data Processing Data

More information

COMP 371/4 Computer Graphics Week 1

COMP 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 information

OpenGL Introduction Computer Graphics and Visualization

OpenGL 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 information