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

SDL_GL_BindTexture behaves differently on GL3 and GLES #3360

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 2 comments
Closed

SDL_GL_BindTexture behaves differently on GL3 and GLES #3360

SDLBugzilla opened this issue Feb 11, 2021 · 2 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2019-08-08 18:17:44 +0000, Malte Kießling wrote:

The Implementations of SDL_GL_BindTexture have different behaviour depending on the selected renderer.

For the GL renderer, depending on the type (yuv or not), either 3 or one texture is bound. The different texture units are also only selected when it is a yuv texture. Otherwise, i assume, the caller is responsible for that.

Both GLES1 and GLES2 only bind a single texture target. This is interesting, as the GLES2 renderer has support for yuv textures, but does not bind them when using GLES2_BindTexture. It does bind them on a yuv render.

As pointed out in bug 3286, this is quite inconsistent.

For the future i would suggest functions that return information (gl texture id?) of the texture type and number of hardware textures used.

Maybe something akin to

int SDL_GL_GetTextureIDs(SDL_Texture* texture, int* count, Uint32** dst); 

would help, and let the user bind it. Or seperate it, like for the update functions.
int SDL_GL_BindTexture(SDL_Texture* texture, float* w, float* h);
int SDL_GL_BindTextureYUV(SDL_Texture* texture, float* w, float* h);
int SDL_GL_GetTextureID(SDL_Texture* texture, int* dst);
int SDL_GL_GetTextureIDYUV(SDL_Texture* texture, Uint32* y, Uint32* u, Uint32* v);

These are just ideas. Id be willing to try my hand at implementing something akin to this, if its generally wanted.

Having access to the underlying driver data for textures in general is nice when interacting with 3rd party libraries. Im not at home in direct x, but i would think that it would help there, too.
(In my case, the current implementation of imgui expects a texture id for drawing images, and integrating imgui with renderer things in general is a tad messy right now).

Have a nice week!
~mkalte

On 2019-08-09 20:46:14 +0000, Malte Kießling wrote:

Created attachment 3924
patch idea

I have written some stuff to show what kind of functionality i thought of when writing this report.

This isn't tested and there likely is more to add and improve.

@mkalte666
Copy link

Shamelessly bumping this, as i still like committing the horrible sin of mixing opengl calls with the renderer.

As an alternative to exposing the texture ids themself the api could also just provide information - if its yuv or not etc - so that one can access the relevant texture units instead of the ids. not sure if that is a better or worse idea though.

@slouken slouken removed the bug label May 11, 2022
@slouken
Copy link
Collaborator

slouken commented Nov 6, 2023

The GLES2 bug was fixed in 01c5554. Discussion of how to handle binding native textures in SDL3 is continuing in #2124.

@slouken slouken closed this as completed Nov 6, 2023
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

No branches or pull requests

3 participants