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

Backends: OpenGL3: Backup and restore GL_PIXEL_UNPACK_BUFFER #7253

Closed
wants to merge 2 commits into from

Conversation

clementgallet
Copy link
Contributor

When creating the font texture with glTexImage2D(), the result is affected by the buffer bound to the GL_PIXEL_UNPACK_BUFFER target. This was causing the following error:

GL error 0x502 returned from 'glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)'.

In the PR, I'm backing up the bound buffer, unbinds the buffer and restoring it at the end. This fixes blank text when hooking Dear ImGui into Yuzu emulator:

Before
After

@ocornut
Copy link
Owner

ocornut commented Jan 22, 2024

Thank you for your PR.
You could find which GL context version this is going to require, and if this will compile with GL ES 2 / ES 3 / WebGL, so can add suitable runtime and/or compile-time checks if necessary?

@ocornut
Copy link
Owner

ocornut commented Jan 24, 2024

According to https://registry.khronos.org/OpenGL/api/GL/glcorearb.h, GL_PIXEL_UNPACK_BUFFER seem so to be a GL 2.1 thing. I will add the corresponding checks and merge this.

ocornut pushed a commit that referenced this pull request Jan 24, 2024
@ocornut
Copy link
Owner

ocornut commented Jan 24, 2024

Merged as 1ce41f6, thank you!

@ocornut ocornut closed this Jan 24, 2024
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