SDL2.0: Possible to apply GLSL shaders to an SDL_Texture?

just curious to why you would want to convert an SDL_Texture to OpenGL texture? heres another thread with same question almost http://forums.libsdl.org/viewtopic.php?t=4872&sid=208a8b8ca866761e3e38bd46e0300ad8

I would suggest using SDL + OpenGL pretty sure GLSL shaders are only available on OpenGL 2.0 and up

After a quick search on the forum found this thread on how to use SDL + OpenGL GLSL shaders even includes an example http://forums.libsdl.org/viewtopic.php?t=6946&sid=e1086f0489c98133fc10fe202ca08214

if you take this path then you don’t need to worry about SDL_Textures and what not hope this helps

twinklebear wrote:> The title is pretty much my question, it seems that the SDL_Texture is sort of an abstraction of an OpenGL texture, (correct me if I’m wrong), so I was wondering if it was possible to apply various shaders to an SDL_Texture. I did see the tutorial on using shaders with SDL but that still uses converting a SDL_Surface to a GLuint and going from there, I was wondering if conversion was still needed. If that’s not possible I was wondering if there was a way to convert from an SDL_Texture to an OpenGL texture? I could only find the guides for converting SDL_Surfaces, and was wondering if converting the texture would be possible.

Thank you

Also sort of sounds like maybe he’s loading an SDL_Surface and converting
it to a texture? If so, you may find this piece of source code useful
(from a project that I’m working on)


(in context with the associated SDL mailing list thread;
http://forums.libsdl.org/viewtopic.php?t=8166&sid=e508d1bd6a03dc977cbafc273f59c1d3
)

Hope that helps, and if not, it’s just some handy code to have :slight_smile:
-AlexOn Wed, Aug 8, 2012 at 12:34 PM, stevo5800 wrote:

**
just curious to why you would want to convert an SDL_Texture to OpenGL
texture? heres another thread with same question almost
http://forums.libsdl.org/viewtopic.php?t=4872&sid=208a8b8ca866761e3e38bd46e0300ad8

I would suggest using SDL + OpenGL pretty sure GLSL shaders are only
available on OpenGL 2.0 and up

After a quick search on the forum found this thread on how to use SDL +
OpenGL GLSL shaders even includes an example
http://forums.libsdl.org/viewtopic.php?t=6946&sid=e1086f0489c98133fc10fe202ca08214

if you take this path then you don’t need to worry about SDL_Textures and
what not hope this helps

twinklebear wrote:

The title is pretty much my question, it seems that the SDL_Texture is
sort of an abstraction of an OpenGL texture, (correct me if I’m wrong), so
I was wondering if it was possible to apply various shaders to an
SDL_Texture. I did see the tutorial on using shaders with SDL but that
still uses converting a SDL_Surface to a GLuint and going from there, I was
wondering if conversion was still needed. If that’s not possible I was
wondering if there was a way to convert from an SDL_Texture to an OpenGL
texture? I could only find the guides for converting SDL_Surfaces, and was
wondering if converting the texture would be possible.

Thank you


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL_Textures aren’t meant to be used with OpenGL calls. They’re part of
SDL2’s rendering API.

However, that functionality is my aim with SDL_gpu. I haven’t ported it to
SDL2 yet, but it would be an add-on-style replacement for the SDL2 texture
rendering API (which I still think should be an add-on).

Jonny D