Opengl入门新手,麻烦大家看一下为什么没有输出结果?

麻烦大家看一下为什么没有输出结果?

opengl3.3,glfw3,glad
查询支持的顶点属性个数。

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
int main() 
{
    GLint nrAttributes=0;
    glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, & nrAttributes);//报错点
    std::cout << "Maximum nr of vertex attributes supported: " << nrAttributes << std::endl;
}

调试到第7行时,如下
图片说明

调用OpenGL函数前要先初始化OpenGL环境,GLFW里面做了封装要先调用

if (!glfwInit())
    return;

 GLFWwindow* w = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);

gfwMakeContextCurrent(w); //启用GL上下文,该函数glfw开头(屏蔽原因)