I'm really stuck on this graphics piece of homework. I'm watching openGL in C++ videos on youtube but have had a rough time piecing it all together. Thank you some much Chegg Team!
Skeleton code provided. Everything is explained on the assignment instructions below.
#ifdef-APPLE #include
#include #include #else #include #include #include #endif #include vector #include using namespace std; class Vertex GLfloatx, yi public: Vertex(GLfloat, GLfloat); GLfloat get y) return yi GLfloat get x() f return xi ; Vertex::Vertex (GLfloat X, GLfloat Y) void setup) glClearColor (1.ef, 1.8f, 1.8f, 1.8f) vector generate_points (vector control_points) vector points; //TODO: // Generate return points; void draw-curve (vector control-points, int n-iter) { // TODO: // Draw a Bezier curve based on the given control points void display() f glClear(GL_COLOR_ BUFFER_BIT I GL_DEPTH_BUFFER BIT) // Set our color to black (R, G, B) // TODO: //Draw cartoon glutSwapBuffers); Assignment 1: Cartoonify Due Friday, February 15, 2019 11:59 PM PST The assignment will focus on the concept of Chaikin, Bzier curve algorithm. Given a headshot photo of an individual (e.g. the headshot of Ed Sheeran), generate the cartoon version of the photo by sketching it using Chaikin or Bzier curves. Skeleton code has been provided to guide you along the way. The places that you will be required to implement has been marked with a TODO I have provided you with a simple Vertex class that allows you to specify the x and y values ofa point. You will utilize this class for modeling the control points of your sketch. "Note: the C++ vector class is the equivalent to a list in most other languages. You maly use the push _back(object o) function of the vector class to hold your set of points. You will complete the following functions for the assignment: 1) generate_points: a function that generates takes in a set of control points for your Chaikin or Bzier curve algorithm and returns the new set of control points parameters: vector vector 2) draw_curve : calls generate_points to generate the control points using the Chaikin or Bzier curve algorithm and forms a curve by connecting the points with lines parameters: vector, int returns none The parameter n_iter refers to the number of iterations to run the Chaikin or Bzier algorithm. Recall that each time the algorithm is ran, you will obtain a set of new points. You will submit the following to Bright Space 1) "assignment1.cpp" 2) Your sketch in JPEG, JPG, or PNG: results.peg, jpg, pngh 3) The photo your sketch was based on in JPEG, JPG or PNG: photo.ipeg, jpg, pngh Grading: I will be compiling the assignment using the following command: gcc -o assignment1 assignment1.cpp -std-c++14 -1GL -LGLU -lglut #ifdef-APPLE #include #include #include #else #include #include #include #endif #include vector #include using namespace std; class Vertex GLfloatx, yi public: Vertex(GLfloat, GLfloat); GLfloat get y) return yi GLfloat get x() f return xi ; Vertex::Vertex (GLfloat X, GLfloat Y) void setup) glClearColor (1.ef, 1.8f, 1.8f, 1.8f) vector generate_points (vector control_points) vector points; //TODO: // Generate return points; void draw-curve (vector control-points, int n-iter) { // TODO: // Draw a Bezier curve based on the given control points void display() f glClear(GL_COLOR_ BUFFER_BIT I GL_DEPTH_BUFFER BIT) // Set our color to black (R, G, B) // TODO: //Draw cartoon glutSwapBuffers); Assignment 1: Cartoonify Due Friday, February 15, 2019 11:59 PM PST The assignment will focus on the concept of Chaikin, Bzier curve algorithm. Given a headshot photo of an individual (e.g. the headshot of Ed Sheeran), generate the cartoon version of the photo by sketching it using Chaikin or Bzier curves. Skeleton code has been provided to guide you along the way. The places that you will be required to implement has been marked with a TODO I have provided you with a simple Vertex class that allows you to specify the x and y values ofa point. You will utilize this class for modeling the control points of your sketch. "Note: the C++ vector class is the equivalent to a list in most other languages. You maly use the push _back(object o) function of the vector class to hold your set of points. You will complete the following functions for the assignment: 1) generate_points: a function that generates takes in a set of control points for your Chaikin or Bzier curve algorithm and returns the new set of control points parameters: vector vector 2) draw_curve : calls generate_points to generate the control points using the Chaikin or Bzier curve algorithm and forms a curve by connecting the points with lines parameters: vector, int returns none The parameter n_iter refers to the number of iterations to run the Chaikin or Bzier algorithm. Recall that each time the algorithm is ran, you will obtain a set of new points. You will submit the following to Bright Space 1) "assignment1.cpp" 2) Your sketch in JPEG, JPG, or PNG: results.peg, jpg, pngh 3) The photo your sketch was based on in JPEG, JPG or PNG: photo.ipeg, jpg, pngh Grading: I will be compiling the assignment using the following command: gcc -o assignment1 assignment1.cpp -std-c++14 -1GL -LGLU -lglut