SDL2 GLSL shader working example, using SDL_Renderer

Hi!

I’ve managed to have a working example of rendering using SDL_Render (to a texture), and rendering the texture to screen using a custom GLSL shader.

You can get it from github, here:

HTH,

Augusto.

6 Likes

A small note, I developed it using MacOSX, which doesn’t require you to load the GL extensions… I’ll update it using GLEW for Windows/Linux as soon as I can. Feel free to contribute and make pull requests if you feel like doing so!

Hi there! Git repo updated, now it builds and works on Windows too (build done using Visual Studio 2017). Take into account that as there’s no no default library path for SDL2 in Windows, libs, headers and dlls should be placed in ./ext folder. README.txt files are provided for ./ext subfolders, so you know where files should go.

Also, I didn’t use GLEW in the end, sou you can see how GL extensions can be loaded using SDL_GL_GetProcAddress.

Now working on linux too. Tested in a 32bit LUbuntu box. Would be nice to have some feedback about other distros. :wink:

Very nice! This is insanely useful for me, as I want to perform post processing if the renderer is not software based.

Do you know how to get this to work on a single texture only, though? From the looks of your example, you clear the renderer before drawing the “shader’d” mesh :(.