Problems with SDL2 and OpenGL

  • Sack TV
    Likes 0

    Problem Description

    I’m currently using GLWF as my window library, but i want to use SDL2 because it also supports iOS. The Youtube tutorial wasn't that helpfull, I managed to open a window with OpenGL but i ran into some problems:

    Edit: i fixed this

    In GLFW there is this command glfwGetFramebufferSize(window, &screenWidth, &screenHeight); but i can’t find a similar command in SDL2. 

    I printed out the framebuffer-size and it was twice the size of my window, so i used it in my SDL2 project and it works, but the spotlight of the camera is not in the middle of the screen and everything is slightly distorted.


    Keyboard inputs are only registered with a delay and the mouse isn’t working that good either.

    This is how it looks like: https://www.youtube.com/watch?v=HFR2ZbWmcAg


  • Sonar Systems admin
    Likes 0

    Are watching my videos to help you with this?

  • Sack TV
    Likes 0

    I only found one video from you on that and i used that.

  • Sonar Systems admin
    Likes 0

    Which one?

  • Sack TV
    Likes 0

    https://www.youtube.com/watch?v=Cc26qCIQNAs&index=6&list=PLRtjMdoYXLf6zUMDJVRZYV-6g6n62vet8&t=0s

  • Sonar Systems admin
    Likes 0

    OK, there isn’t a similar command, the code is slightly different.

  • Sack TV
    Likes 0

    Have you read my edit? I just need the code to get keyboard inputs and mouse positions in SDL that work like in GLFW.

  • Sonar Systems admin
    Likes 0

    Oh ok, this will help with that http://lazyfoo.net/SDL_tutorials/lesson10/index.php 

  • Sack TV
    Likes 0

    Solved, thanks this site is very good!

  • Sonar Systems admin
    Likes 0

    You’re welcome.

     

    If you have anymore questions feel free to post them.

Login to reply