Skip to content

OpenGL ES Fix #270

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

OpenGL ES Fix #270

wants to merge 1 commit into from

Conversation

Waterdish
Copy link

This centers the viewport and fixes opengl es not rendering anything on mobile devices.

…that broke the opengl es renderer on mobile devices
@@ -222,7 +222,7 @@ static void OpenGLRenderer_EndDraw() {
if (!g_opengl_es)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_draw_width, g_draw_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, g_screen_buffer);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_draw_width, g_draw_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, g_screen_buffer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, g_draw_width, g_draw_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, g_screen_buffer);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GL_BGRA doesn't appear to be a valid value for this parameter?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting a GL_INVALID_VALUE (0x501) error until I changed the internal format to match the format. Having them both as GL_RGBA also worked, but I got a black screen with GL_RGBA as the internal format and GL_BGRA as the format. I found the solution on this page: https://stackoverflow.com/questions/50717395/how-to-load-a-bgra-image-texture-in-gles2

It may be an issue specific to android, but it fixed the errors on both an x86-64 android emulator and physical android device with an Adreno 630 GPU.

danielsoares02 added a commit to danielsoares02/zelda3 that referenced this pull request Jan 5, 2025
Correção no src/main.cs, pullrequest snesrev#247

Correção no src/opengl.cs, pullrequest snesrev#270

Correção no src/platform/switch/Makefile, pullrequest snesrev#273

Correção no MakeFile, pullrequest snesrev#276

Correção no src/select_file.c, pullrequest snesrev#292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants