SFML 和 OpenGL 在调用绘制函数时导致 GL_INVALID_OPERATIONS
SFML and OpenGL causes GL_INVALID_OPERATIONS when calling the draw function
我正在我的主计算机上开发一个小型游戏引擎,但是当我在我的笔记本电脑上克隆该项目时,我收到了很多错误消息并显示了一个空白屏幕。
以下是我在调用 SFML 绘制函数时得到的每一帧的一些错误消息:
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 4.4 ; depth bits = 24 ; stencil bits = 8 ; AA level = 1 ; core = false ; debug = false ; sRGB = false
Created: version = 4.5 ; depth bits = 24 ; stencil bits = 8 ; AA level = 4 ; core = true ; debug = false ; sRGB = false
An internal OpenGL call failed in RenderTarget.cpp(369).
Expression:
GLEXT_glClientActiveTexture(GLEXT_GL_TEXTURE0)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in RenderTarget.cpp(375).
Expression:
glDisable(GL_LIGHTING)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(377).
Expression:
glDisable(GL_ALPHA_TEST)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(378).
Expression:
glEnable(GL_TEXTURE_2D)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(380).
Expression:
glMatrixMode(GL_MODELVIEW)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in RenderTarget.cpp(381).
Expression:
glEnableClientState(GL_VERTEX_ARRAY)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
我只是在菜单屏幕中绘制精灵和纹理,似乎连 OpenGL 函数绘制也产生错误。这是我的 github 回购的 link:https://github.com/ZzkilzZ/mfengine
我的两台计算机上都是 运行 Ubuntu 的 LTS 版本,我认为可能是某些依赖项的版本存在差异?
编辑:
这些是我的 glxinfo 结果:
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.0.8
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 19.0.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
我是 运行 Ubuntu 18.4 LTS
您正在创建 OpenGL Core Profile 上下文,但代码使用了遗留的固定功能内容,例如 glDisable(GL_LIGHTING)
。解决方案是在创建上下文时请求兼容性配置文件。如果兼容性配置文件可用,则取决于您的 OpenGL 实现。我建议你找一个更现代的示例代码。
似乎可以在 SFML 的 sf::ContextSettings::attributeFlags
或
中设置兼容性配置文件
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR,4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR,5);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_COMPAT_PROFILE);
感谢@SurvivalMachine 和@derhass 的帮助!
我最终将 opengl 降级到 3.0 版,将 glsl 降级到 130 核心,并让菜单屏幕再次工作。它加载除着色器之外的所有内容,但我怀疑这是我使用更现代功能的结果。我要放弃旧电脑了,这似乎是为了让 2015 年的电脑工作而牺牲太多:D
我正在我的主计算机上开发一个小型游戏引擎,但是当我在我的笔记本电脑上克隆该项目时,我收到了很多错误消息并显示了一个空白屏幕。
以下是我在调用 SFML 绘制函数时得到的每一帧的一些错误消息:
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 4.4 ; depth bits = 24 ; stencil bits = 8 ; AA level = 1 ; core = false ; debug = false ; sRGB = false
Created: version = 4.5 ; depth bits = 24 ; stencil bits = 8 ; AA level = 4 ; core = true ; debug = false ; sRGB = false
An internal OpenGL call failed in RenderTarget.cpp(369).
Expression:
GLEXT_glClientActiveTexture(GLEXT_GL_TEXTURE0)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in RenderTarget.cpp(375).
Expression:
glDisable(GL_LIGHTING)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(377).
Expression:
glDisable(GL_ALPHA_TEST)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(378).
Expression:
glEnable(GL_TEXTURE_2D)
Error description:
GL_INVALID_ENUM
An unacceptable value has been specified for an enumerated argument.
An internal OpenGL call failed in RenderTarget.cpp(380).
Expression:
glMatrixMode(GL_MODELVIEW)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in RenderTarget.cpp(381).
Expression:
glEnableClientState(GL_VERTEX_ARRAY)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
我只是在菜单屏幕中绘制精灵和纹理,似乎连 OpenGL 函数绘制也产生错误。这是我的 github 回购的 link:https://github.com/ZzkilzZ/mfengine
我的两台计算机上都是 运行 Ubuntu 的 LTS 版本,我认为可能是某些依赖项的版本存在差异?
编辑: 这些是我的 glxinfo 结果:
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.0.8
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 19.0.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
我是 运行 Ubuntu 18.4 LTS
您正在创建 OpenGL Core Profile 上下文,但代码使用了遗留的固定功能内容,例如 glDisable(GL_LIGHTING)
。解决方案是在创建上下文时请求兼容性配置文件。如果兼容性配置文件可用,则取决于您的 OpenGL 实现。我建议你找一个更现代的示例代码。
似乎可以在 SFML 的 sf::ContextSettings::attributeFlags
或
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR,4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR,5);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_COMPAT_PROFILE);
感谢@SurvivalMachine 和@derhass 的帮助! 我最终将 opengl 降级到 3.0 版,将 glsl 降级到 130 核心,并让菜单屏幕再次工作。它加载除着色器之外的所有内容,但我怀疑这是我使用更现代功能的结果。我要放弃旧电脑了,这似乎是为了让 2015 年的电脑工作而牺牲太多:D