Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My Code is included below. I can't seem to get it to work due to syntax error I think (on line 45 according to Visual

image text in transcribedMy Code is included below. I can't seem to get it to work due to syntax error I think (on line 45 according to Visual Studio). Please Help

// ModuleTwoTriangles.cpp : This file contains the 'main' function. Program execution begins and ends there. //

#include #include #include //GLEW Library #include //GLFW Library

int main() { using namespace std; //Use the standard namespace

#define WINDOW_TITLE "Garrett Price Modern OpenGL Triangles" //Macro for window title

//Variables for window width and height int Windowwidth = 800, WindowHeight = 600;

struct GLMesh { GLuint vao; //for the vertex array GLuint vbo; //for the vertex buffer GLuint nvertices; /umber of vertices };

//Vertx & Fragment Shader Source Macro #ifndef GLSL #define GLSL(Version, Source) "#version " #Version "n"#Source #endif /*User-defined Function to: intialize, set the window size, redraw the graphics once resized, and render the graphics. PULLED FROM TUTORIAL CODE*/ bool UInitialize(int, char* [], GLFWwindow** window); void UResizeWindow(GLFWwindow* window, int width, int height); void UProcessInput(GLFWwindow * window); void UCreateMesh(GLMesh & mesh); void UDestroyMesh(GLMesh & mesh); void URender(); void UCreateShaderProgram(const char* vtxShaderSource, const char* fragShaderSource, GLuint & programId); void UDestroyShaderProgram(GLuint programId); void URenderGrapgics(void);

int main(int argc, char* argv[]) { UInitialize(argc, argv); glutMainLoop(); exit(EXIT_SUCCESS); }

void UInitialize(int argc, char* argv[]) { GLenum GlewInitResults; UInitWindow(argc, argv);

GlewInitResult = glewInit(); if (GLEW_OK != GlewInitResult) { fprint(stderr, "ERROR %n", glewGetErrorString(GlewInitResult)); exit(EXIT_FAILURE); } fpprint(stdout, "INFO: OpenGL Version: %sn", glGetString(GL_VERSION));

glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

}

void UInitWindow(int argc, char* argv[]) {

glutInit(&argc, argv);

glutInitWindowSize(WindowWidth, WindowHeight);

glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE_RGBA);

glutCreateWindow(WINDOW_TITLE);

glutReshapeFunc(UResizeWindow); glutDisplayFunc(URenderGraphics);

}

void UResizeWindow(int Width, int Height) { glViewport(0, 0, Width, Height); }

void UrenderGrapgics(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glutSwapBuffers(); } }

up correctly (which you learned how to do in the previous module). The goal of this assignment is to write commented modern OpenGL code that creates two right-angle triangles. Specifically, you must address the following rubric criteria: Create code to address the required functionality. The work you complete in OpenGL must meet the required functionality and visual representation that are outlined for this particular topic. Achieving this result may require multiple attempts or the application of programming strategies, but that is okay! Working in iterations is an important part of any coding project. You may also wish to refer back to relevant sections of this week's tutorial for further guidance or review. Apply logic and proper syntax to code. Source code should be free of logical or syntax errors that prevent the application from running as expected. You will be given credit for code that is well on its way to meeting specifications or solving the problem. Apply commenting and formatting standards to facilitate understanding of the code. All code should be well commented. This is a practiced art that requires clarity and concision. Your comments should explain the purpose of lines or sections of the code and may also include the method you used to achieve a specific task in the code. Be sure to document any sections of code that are producing errors or incorrect results. Also, all code should be organized to meet formatting standards

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago