Segmentation Fault ocurring with glfw using the func_cpp style

Issue #83 new
baryc
created an issue

It throws a Segmentation Fault when calling any opengl function. I am using glfw with glLoadGen with func_cpp style.

#include"Graphics/gl_core_3_3.hpp"
#include<GLFW/glfw3.h>

int main(int argc, char** argv) {
    GLFWwindow* window;

    if (!glfwInit())
        return -1;


    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    window = glfwCreateWindow(640, 480, "Game", NULL, NULL);
    if (!window) {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);


    gl::Clear(gl::COLOR_BUFFER_BIT); //SegFault

    while (!glfwWindowShouldClose(window)) {
        glfwSwapBuffers(window);

        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

but it works with the pointer_c style. Is there a way to make it work with func_cpp?

Comments (1)

  1. Log in to comment