Window appearing but unable to draw to it with OpenGL

4

I am working through a basic OpenGL course on udemy and am having trouble getting it started. I am able to get the window to display, but it is just black and will crash a few seconds later saying:

"Exception thrown at 0x55334515 (ig11icd32.dll) in OpenGLCourseApp.exe: 0xC0000005: Access violation writing location 0x078C0000." - something to do with symbols I think?

I saw that someone had a similar issue before that was solved by updating the graphics card drivers. I am using the built-in Intel Iris Plus graphics on a Surface Pro 7 with the most up to date driver (25.20.100.7101). The processor claims to have support for OpenGL 4.5. I have tried both 32 and 64 bit setups during troubleshooting with no difference. I'm not sure if I am doing something wrong with the setup or if I will need to use a machine with a more robust graphics processor to finish the course.

The most recent GLEW and GLFW libraries are being used.

Some PC specs:

  • Intel Core i5-1035G4
  • 8GB RAM
  • Windows 10 Home
  • Intel Iris Plus Graphics
  • Visual Studio 2019

For reference, here is my code:

#include <stdio.h>
#include <GL\glew.h>
#include <GLFW\glfw3.h>

const GLint WIDTH = 800, HEIGHT = 600;

int main() 
{
    if (!glfwInit()) 
    {
        printf("GLFW INITIALIZATION FAILED!");
        glfwTerminate();
        return 1;
    }
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    GLFWwindow *mainWindow = glfwCreateWindow(WIDTH, HEIGHT, "Test Window", NULL, NULL);
    if (!mainWindow) 
    {
        printf("GLFW WINDOW CREATION FAILED!");
        glfwTerminate();
        return 1;
    }

    int bufferWidth, bufferHeight;
    glfwGetFramebufferSize(mainWindow, &bufferWidth, &bufferHeight); 

    glfwMakeContextCurrent(mainWindow);

    glewExperimental = GL_TRUE;

    if (glewInit() != GLEW_OK) 
    {
        printf("GLEW INITIALIZATION FAILED!");
        glfwDestroyWindow(mainWindow);
        glfwTerminate();
        return 1;
    }

    glViewport(0, 0, bufferWidth, bufferHeight);

    while (!glfwWindowShouldClose(mainWindow)) 
    {
        glfwPollEvents();

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

        glfwSwapBuffers(mainWindow);
    }

    return 0;
}

Any guidance for a newbie hobbyist would be appreciated!

c++
opengl
glfw
glew
asked on Stack Overflow Dec 28, 2019 by dmrich91 • edited Dec 28, 2019 by Rabbid76

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0