Segmentation fault when including glad.h

后端 未结 1 405
旧巷少年郎
旧巷少年郎 2021-01-23 03:26

I am following the GLFW guide to getting started but I can\'t seem to make it run with GLAD.

Here\'s my C file (prac.c)

#include 
#include         


        
相关标签:
1条回答
  • 2021-01-23 04:10

    You have to call initialize glad before calling any OpenGL instruction.
    That means gladLoadGL() has to be done before glGetString(GL_VERSION):

    glfwMakeContextCurrent(window);
    
    gladLoadGL();
    
    printf("OpenGL version: %s\n", glGetString(GL_VERSION));
    
    0 讨论(0)
提交回复
热议问题