Exception thrown at 0x00E3CC4F : 0xC0000005: Access violation reading location 0x000002A4

0
#include "libs.h"

int main()
{
    //Initializing
    const int WIDTH = 640;
    const int HEIGHT = 480;
    int frameBufferWidth = 0;
    int frameBufferHeight = 0;
    //..

    GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Game", nullptr, nullptr);

    glfwGetFramebufferSize(window, &frameBufferWidth, &frameBufferHeight); // <---- EXCEPTION
    glViewport(0, 0, frameBufferWidth, frameBufferHeight);

    glfwMakeContextCurrent(window);

    //Init GLEW
    glewExperimental = GL_TRUE;

    if (glewInit() != GLEW_OK) {
        std::cout << "ERROR::MAIN.CPP::GLEW_INIT_FAILED\n";
        glfwTerminate();
    }

    //Main loop
    //...

    return 0;
}

I have no idea why exception is thrown. I suspect that I am doing something wrong with frameBufferWidth and frameBufferHeight, but I cannot figure out what exactly. Help please! I'm new in OpenGL, so do not judge strictly.

c++
visual-studio
opengl
glfw
glew
asked on Stack Overflow May 23, 2020 by Dolphin

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0