Question
COMPUTER GRAPHICS In this assignment, you are to create an OpenGL 2D scene of your choosing with the following requirements: 1) The scene should make
COMPUTER GRAPHICS
In this assignment, you are to create an OpenGL 2D scene of your choosing with the following requirements:
1) The scene should make sense and be intentional (not a bunch of random shapes/colors).
2) Must have at least five distinct shapes (circle is a shape).
3) Must have at least one circle using a for loop and trigonometry.
4) Must have at least five unique colors.
The zipped file assignment0.zip contains a Visual Studio 2013 C++ solution to get you started, including a skeleton file named assignment0.cpp where all your code should go. Make sure you have Visual Studio
#include "../shared/gltools.h" // OpenGL toolkit
/////////////////////////////////////////////////////////// // Called to draw scene void RenderScene(void) { // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT);
glPointSize(15.0);
glBegin(GL_POINTS); glColor3f(3, 0, 0); glVertex2i(700, 700); glColor3f(0, 50, 0); glVertex2i(720, 720); glColor3f(0, 0, 1); glVertex2i(740, 740); glColor3f(0, 0, 0); glVertex2i(760, 760); glEnd();
glColor3f(0, 0, 1); glBegin(GL_TRIANGLES); glVertex2i(0,0); glVertex2i(640,0); glVertex2i(320,480); glEnd();
glColor3f(1, 0, 0); glBegin(GL_QUADS); glVertex2i(800, 800); glVertex2i(900, 800); glVertex2i(700, 700); glVertex2i(800, 900); glEnd();
// Flush drawing commands and swap the buffer glutSwapBuffers(); }
void TimerFunction(int value) { // Redraw the scene with new coordinates glutPostRedisplay(); glutTimerFunc(16,TimerFunction, 1); }
/////////////////////////////////////////////////////////// // Setup the rendering context void SetupRC(void) { glClearColor(1.0f, 1.0f, 1.0f, 0.0f); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, 1000.0, 0, 1000.0); }
/////////////////////////////////////////////////////////// // Main program entry point int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(800,800); glutCreateWindow("Assignment 0"); glutDisplayFunc(RenderScene); glutTimerFunc(16, TimerFunction, 1); SetupRC(); glutMainLoop(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started