Jump to content
  • Advertisement
Sign in to follow this  
Krisztian

OpenGL SDL2 - OpenGL

This topic is 633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently working on a personal 2D project, but I'm interested in trying a little 3D, I don't have a background in that and I'm brushing up on the mathematics at this time.

 

There are ton's of SDL2 tutorials, but I can't seem to find an excellent example to use OpenGL with SDL2. Can someone recommend a good tutorial?

 

...and I want to move from 0 to some application and I think the route is from Triangle to Object Viewer. What's the best lesson plan for that?

 

Share this post


Link to post
Share on other sites
Advertisement

There are many, many tutorials out there on how to set up an OpenGL context using libSDL. The API in that respect is almost unchanged in libSDL2, so they still apply. Then, you need to jump to one of the many, many tutorials on using OpenGL because other than a brief sojourn setting up the context and handling input though libSDL2, that will dominate your life.

Disregard the older (fixed pipeline) OpenGL tutorials. You want at least OpenGL 3.0 or later.

Share this post


Link to post
Share on other sites

There are ton's of SDL2 tutorials, but I can't seem to find an excellent example to use OpenGL with SDL2. Can someone recommend a good tutorial?

 

There are many tutorials out there to do this, I would start off by finding one that is a simple a creating an SDL window with an OpenGL context that can draw a triangle or square. This is one of many but covers all of the very basics you need to get started: http://lazyfoo.net/tutorials/SDL/51_SDL_and_modern_opengl/

 

 

One thing you will find, if you have done anything in 2D with SDL, is that if you are going to use 3D you will have to do a lot more work in order to get anything drawn to the screen. Such as compiling and linking shaders and creating Vertex Buffer Objects (VBOs) etc. OpenGL is also old, the early versions (before version 3) use the fixed pipeline so be careful when reading tutorials as they might be using the fixed pipeline which you do not want to use.

Share this post


Link to post
Share on other sites

For OpenGL, learnopengl.com  works nicely.

It uses GLFW instead of SDL2, but besides the window creation, window refresh, and the input handling, everything is valid.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!