gpt4 book ai didi

c++ - glGenQueries 总是返回非查询对象,glBeginQuery 返回错误

转载 作者:行者123 更新时间:2023-11-28 01:51:04 28 4
gpt4 key购买 nike

我正在尝试使用 openGL 3.3、GLFW、GLEW 创建遮挡查询

加载函数:

uint32_t glQueryID;
glGenQueries(1, &glQueryID);
if (glIsQuery(glQueryID)) //just for testing its always false !
{
... it must be always true !?!
}

绘制函数:

glBeginQuery(GL_ANY_SAMPLES_PASSED, glQueryID);
glGetError();// 1282 invalid operation

但是我所有其他的 glCalls 都正常工作,没有任何错误

在 Mac OS X 上运行,intel HD 4000

最佳答案

来自 glIsQuery 的文档:

glIsQuery returns GL_TRUE if id is currently the name of a query object. If id is zero, or is a non-zero value that is not currently the name of a query object, or if an error occurs, glIsQuery returns GL_FALSE.

A name returned by glGenQueries, but not yet associated with a query object by calling glBeginQuery, is not the name of a query object.

由于您在将查询对象分配给它之前调用了 glIsQuery(例如通过调用 glBeginQuery),因此返回值必须是 GL_FALSE .

关于c++ - glGenQueries 总是返回非查询对象,glBeginQuery 返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43019913/

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