我在我的代码中发现了错误。就我而言,我不应该只有一个...... 在运行时我遇到各种错误都指向已弃用的固定函数调用。 现在这里是踢球者。出于测试目的,除了一些初始化调用之外,我删除了所有绘制调用和其他OpenGl命令。该程序仍会打印出一堆错误(尽管没有一次调用)
我使用AMD Radeon R9 270在Windows 10上运行,驱动程序版本:15.201.1151-150821a-188665E 我使用glfw-3.0.4和glew 1.10.0
这里是初始化所有内容的代码。 bool Application :: initWindow() { if(!glfwInit()) { Console :: writeError(" GLFW Init失败!"); 返回false; } #if _DEBUG glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT,GL_TRUE); #ENDIF
// Set window hints
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_REFRESH_RATE, 60);
window = glfwCreateWindow(WIDTH, HEIGHT, "Window", nullptr, nullptr);
if (!window) {
Console::writeError("Creating Window failed!");
return false;
}
glfwMakeContextCurrent(window);
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
{
Console::writeError("Glew Init failed!");
return false;
}
// Glew produces an arbitrary error therefore ignore it
glGetError();
DebugContext::initDebugContext();
glClearColor(0.49f, 0.73f, 1.0f, 0.0f);
glViewport(0, 0, WIDTH, HEIGHT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return true;
}
这是在运行时调用的代码: void Application :: run(){
float lastTime = 0;
auto time = glfwGetTime();
float deltaT = (float)(time - lastTime);
lastTime = (float)time;
// Game Loop
while (isRunning && !glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Calculate Frame Time
time = glfwGetTime();
deltaT = float(time - lastTime);
lastTime = time;
glfwPollEvents();
//Console::writeMessage("FrameTime: " + std::to_string(deltaT));
//Mouseinteraction
//handleMouseMove(window, deltaT);
//CameraControll
// cameraController->update(deltaT);
// Upate Scene
//scene->update(deltaT / 1000);
// Render Scene
//renderer->draw(scene);
glfwSwapBuffers(window);
}
Console::writeMessage("Application::run() finished");
Destroy();
}
框架使用清晰的颜色正确着色。 最后,我的错误处理类输出为单帧。每个帧都会出现此错误。奇怪的是,这些错误不会发生在第一帧,而是在10-15秒后发生。
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xbb1' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xd3b' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glPushClientAttrib has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xbb0' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xd35' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glPushAttrib has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xba4' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xd38' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glPushMatrix has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xba3' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glGetIntegerv in a Core context with parameter <pname> and enum '0xd36' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glPushMatrix has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: Using glDisable in a Core context with parameter <cap> and enum '0xb50' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glEnable in a Core context with parameter <cap> and enum '0xbc0' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glAlphaFunc has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: Using glDisable in a Core context with parameter <cap> and enum '0xde0' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: Using glEnable in a Core context with parameter <cap> and enum '0xde1' which was removed from Core OpenGL (GL_INVALID_ENUM) [Source = API, Type = Error, Severity = High, ID = 3200]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glLoadIdentity has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glOrtho has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glLoadIdentity has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203
OpenGL Error: glPopMatrix has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glMatrixMode has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glPopMatrix has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glPopAttrib has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
OpenGL Error: glPopClientAttrib has been removed from OpenGL Core context (GL_INVALID_OPERATION) [Source = API, Type = Error, Severity = High, ID = 3203]
非常感谢任何帮助! 谢谢,
吉米