应该使用下面的代码进行测试。需要一个有效的上下文来调用opengl函数
#include<iostream>
#include<glad/glad.h>
#include<GLFW/glfw3.h>
int nrAttributes =0;
int main()
{
glfwInit();
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &nrAttributes);
std::cout << "Maximum nr of vertex attributes supported: " << nrAttributes << std::endl;
}
参考文档:https://www.javaer101.com/article/30534323.html