PDA

View Full Version : OpenGL Shader in SDL Platform Game?



GoldStud
05-10-2014, 07:33 PM
Hello! I am new to SDL and just got a simple platform game with wall jumping and music to run:

1300

I have spent a lot of time trying to figure out how to implement an OpenGL Shader into this game. I use SDL_Surfaces rendered with an SDL_Renderer. I an OpenGL context initialized in my SDL program, and my question is: How do I set up OpenGL fragment shaders so that they will shade what SDL renders?

My plan is to use a God Ray shader.

GClements
05-11-2014, 05:40 AM
How do I set up OpenGL fragment shaders so that they will shade what SDL renders?
You don't. If you want to use shaders, use OpenGL for rendering, instead of SDL.

If you just want to perform post-processing on a rendered scene, you can use SDL to render into an SDL_Texture, then use OpenGL to render that texture to the screen using a shader.

If you want to use OpenGL features during the rendering process, then you should forget about using SDL rendering functions and use OpenGL instead. You can still use SDL for window management and input handling.