My workflow is basically the following:
I tried to use the following code to bind my
SDL_Texture in opengl:
if (SDL_GL_BindTexture(myTexture, NULL, NULL)) throw SDL_GetError(); glUniform1i(glGetUniformLocation(programID, "texture1"), 0);
SDL_GL_BindTexture always returns -1, and the SDL error is “Operation not supported”.
I can’t use
SDL_LockTexture to create a texture using raw pixel data with
glTexImage2D, and then bind this new texture, because my
SDL_Texture is created with the
SDL_TEXTUREACCESS_TARGET flag, and thus I can’t set the
SDL_TEXTUREACCESS_STREAMING flag (else
SDL_SetRenderTarget complains that the texture hasn’t been initialized as a target).
I tried several hacks to retrieve the
GLuint of the
SDL_Texture, however it appears to be always 0.
Thus, how could I bind my SDL_Texture to send it to my fragment shader?