fix: surface texture resolution does not change#111
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #110 by updating how the SurfaceTexture’s GL texture is created and managed, ensuring that texture IDs are generated on the rendering thread rather than using a plain int array.
- Replaced the
int[] texturesarray with anIntBufferfor GL texture ID management. - Moved
glGenTexturesandglBindTexturecalls into aGdx.app.postRunnableto run on the GL thread. - Updated
getTextureExternaland cleanup to use the newtextureBuffer.
Comments suppressed due to low confidence (2)
gdx-video-android/src/com/badlogic/gdx/video/VideoPlayerAndroid.java:145
- Accessing
textureBufferbefore it’s initialized can lead to a NullPointerException or stale values ingetTextureExternal. Consider pre-allocating the buffer or adding a null-check (or synchronization) to guard against race conditions.
textureBuffer = BufferUtils.newIntBuffer(1);
gdx-video-android/src/com/badlogic/gdx/video/VideoPlayerAndroid.java:149
- After binding the external OES texture, set appropriate parameters (e.g.,
GL_TEXTURE_MIN_FILTER,GL_TEXTURE_MAG_FILTER, and wrap modes) to ensure correct sampling and prevent default settings from impacting resolution or visual quality.
Gdx.gl.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureID);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #110
@dasisdormax Do you mind doing a quick review?