Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NEED HELP FIXING C++ Hell I am desperately trying to build a window in XCode usi

ID: 3917889 • Letter: N

Question

NEED HELP FIXING C++

Hell I am desperately trying to build a window in XCode using GLFW and GLEW but there are several issues wrong with my code. Please help

#include <iostream>

//GLEW

#define GLEW_STATIC

#include <GL/glew.h>

//GLFW

#include <Opengl/gl.h>

#define GLFW_INCLUDE_GLCOREARB

#include <OpenGL/gl3.h>

#if defined(GLFW_INCLUDE_GLEXT)

#include <OpenGL/gl3ext.h>

#endif

int main(void)

{

GLFWwindow* window;

  

/* Initialize the library */

if (!glfwInit())

return -1;

  

/* Create a windowed mode window and its OpenGL context */

window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);

if (!window)

{

glfwTerminate();

return -1;

}

  

/* Make the window's context current */

glfwMakeContextCurrent(window);

  

/* Loop until the user closes the window */

while (!glfwWindowShouldClose(window))

{

/* Render here */

glClear(GL_COLOR_BUFFER_BIT);

  

/* Swap front and back buffers */

glfwSwapBuffers(window);

  

/* Poll for and process events */

glfwPollEvents();

}

  

glfwTerminate();

return 0;

}

Explanation / Answer

Please hit Thumbs Up if you find this answer useful.