gpt4 book ai didi

c++ - 调用 glGenVertexArrays 时程序崩溃

转载 作者:可可西里 更新时间:2023-11-01 15:03:25 26 4
gpt4 key购买 nike

我正在尝试学习如何在 opengl 中编程并且正在使用 this tutorial .教程 1 工作正常,教程 2 崩溃并返回 1。

它失败了:

GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

具体来说:

glGenVertexArrays(1, &VertexArrayID);

有什么建议吗?也相关但从未解决OpenGL, FreeGlut and Glew crash with glGenVertexArrays call

最佳答案

看完这篇thread似乎在调用

glewExperimental = GL_TRUE; 
glewInit();

会解决问题。阅读 glewExperimental here , 它说

GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported. To circumvent this situation, the glewExperimental global switch can be turned on by setting it to GL_TRUE before calling glewInit(), which ensures that all extensions with valid entry points will be exposed.

我不太确定这对 glGenVertexArrays 有何帮助,但值得一试

关于c++ - 调用 glGenVertexArrays 时程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13558073/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com