Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GL_INVALID_ENUM error in imgui_impl_opengl3 when calling glGetIntegerv on GL_CLIP_ORIGIN #3998

Closed
wants to merge 2 commits into from

Conversation

s7jones
Copy link
Contributor

@s7jones s7jones commented Apr 2, 2021

On OpenGL 3.20 with GLEW I have found that GL_CLIP_ORIGIN is defined and therefore the code block is run but it is invalid to call glGetIntegerv on GL_CLIP_ORIGIN in OpenGL 3.20 (Intel HD 4000).

The resulting invalid call causes a GL_INVALID_ENUM to be returned.

This fix adds a runtime check to ensure that we're using OpenGL 4.5 before using the clip control functionality.

…egerv on GL_CLIP_ORIGIN.

- On OpenGL 3.20 with GLEW I have found that GL_CLIP_ORIGIN is defined and therefore the code block is run but it is invalid to call glGetIntegerv on GL_CLIP_ORIGIN in OpenGL 3.20.
@ocornut
Copy link
Owner

ocornut commented Apr 6, 2021

Hello @s7jones, thanks for the PR and pointing out to this issue.
AFAIK you haven't tested this as bool clip_origin_lower_left is now declared in a scope which is inaccessibel to its other uses, so code won't compile if GL_CLIP_ORIGIN is defined.

Additionally, I feel like if we test for g_GlVersion >= 450 we might be able to remove the __APPLE__ test.

@ocornut
Copy link
Owner

ocornut commented Apr 6, 2021

Reworked as 71dda21 and merged, thank you!

@ocornut ocornut closed this Apr 6, 2021
@s7jones
Copy link
Contributor Author

s7jones commented Apr 6, 2021

Hi @ocornut.

bool clip_origin_lower_left is now declared in a scope which is inaccessibel to its other uses

Sorry about that, I had tested on my local conan setup and then transcribed the changes to master - but didn't spot that.

Thanks for the merge.

ocornut added a commit that referenced this pull request May 24, 2021
…clip_control" extension is detected. (#4170, #3998)

Expecting this to somehow cause another issue but we will fix it when it comes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants