Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: OpenGL Shader in SDL Platform Game?

  1. #1
    Newbie Newbie
    Join Date
    May 2014
    Posts
    1

    OpenGL Shader in SDL Platform Game?

    Hello! I am new to SDL and just got a simple platform game with wall jumping and music to run:

    Attachment 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.

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    490
    Quote Originally Posted by GoldStud View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •