无法从 OpenGL 3.2 / 3.3 检索版本信息
我遵循了这里的基本说明:
我唯一调整的是创建 3.2 或3.3:
const int attributes[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
然后在创建上下文(成功返回 TRUE)之后,我检查版本:
// Double check the version (old way)
const GLubyte *const pszGLVersion = glGetString(GL_VERSION);
// Double check the version (new way)
GLint glVersion[2];
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
但是,pszGLVersion 为 NULL,并且 glVersion[0] 和 glVersion[1] 都未初始化!
为什么创建 OpenGL 3.2 & 3.3 context成功,但是获取版本信息失败?
I've followed the basic instructions here:
The only thing I've tweaked is the creation of the context to be 3.2 or 3.3:
const int attributes[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
And then after the creation of the context (which returns TRUE for success) I check the version with:
// Double check the version (old way)
const GLubyte *const pszGLVersion = glGetString(GL_VERSION);
// Double check the version (new way)
GLint glVersion[2];
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
However, pszGLVersion is NULL, and glVersion[0] and glVersion[1] are both left uninitialised!
Why does the creation of an OpenGL 3.2 & 3.3 context succeed, but then fail to get version information?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否将上下文设置为当前上下文?您会注意到,
glGetString
不采用上下文参数,它适用于当前上下文。在调用wglMakeCurrent
之前您无法使用它,默认情况下新创建的上下文不会成为当前上下文。Did you make the context current? You'll note that
glGetString
doesn't take a context parameter, it works on the current context. You can't use it until after you callwglMakeCurrent
, a newly created context is not made current by default.我认为我无法获取版本信息的原因是因为我的显卡不支持3.2或3.3。
I think the reason I can't get the version information out is because my graphics card doesn't support 3.2 or 3.3.