Blog contents


Programming in C++11 and SDL2

Welcome to my blog abut C++11 and game programming in SDL2! Here you’ll find a list of all the tutorials on this blog.

Here you will find mainly tutorials on SDL2 and OpenGL but also a few other post. I try to make my tutorials a bit slow paced, dwelling a bit longer on each subject in order to be able to give more details and better understanding of each subject. This is hugely important because development is always hard when you don’t know all the details, how things work, what each line of coed does etc.

Hopefully my blogs will teach you all you need to make an awesome game!

If you have any questions about anything, please check out the forums.

Game programming in OpenGL ( and SDL2 )

My newest tutorial. Aims to teach you all about OpenGL and help you understand what each function does, how and when you should call it. This can be very hard in OpenGL ( a lot harder than in SDL2 ) but at the same time ; 3d is awesome!

You can find the OpenGL forum here.

Part 1 – Setting up OpenGL

OpenGL using SDL2. Using SDL2 with OpenGL makes it really easy. And it’ll all be multi-platform. And if you’ve already read my previous tutorials on SDL2, you already know a lot about using SDL2 with OpenGL

Part 2 – Vertexes, VBOs and VAOs

An introduction to how we can use VAOs and VBOs, what they are and how we can use them to represent object models, colors and more.

Part 3 – Shaders

Shaders are small pieces of code that runs on the GPU. We use them to move objects around, set color/lighting and more.

Part 4 – 3D basics

We finally take the step into 3D! Learn about how we project models from 3D space onto a 2D plane ( your screen ). We also take a look at verticies and matrices, inclduing translation matrix, view matrix and projection matrix.

Part 5 – Matrix operations

We take a closer look at matrix operations and learn how to move, scale and rotate objects using matrices and glm

Game programming in SDL2

A tutorial about making games. Focuses a lot on SDL 2, but also other topics related to game programming. Some parts are pretty extensive so that you’ll get a deeper understanding about what’s going on.

You can find the SDL 2 forum here.

Part 1 – Setting up SDL 2

This part gives you a quick introduction to SDL 2. It’ll help you set up SDL2 including header files, linking and everything you need to get SDL 2 up and running. It also contains a bare-boned SDL2 program.

Setting up Visual Studio for SDL2

A guide on how to set up Visual Studio for SDL2 development. Also includes a fix for Visual Studio 2015 ( which failed when you tried to compile it with SDL2 stuff because they changed it. ) This guide also works for setting up additional libs like SDL2_image, SDL2_ttf and SDL2_net

Part 2 – Your first SDL 2 application

Here we take a look at the two basic structs of SDL 2, SDL_Window and SDL_Renderer. It’ll help you understand what these do and how to initialize them and the basics of SDL2 correctly. We also take a look at how to set the render color ( which also works as background color )

Part 3 – Drawing rectangles

Here we take a look at SDL_Rect and how to render it with SDL_RenderDrawRect and SDL_RenderFillRect.

Part 4 – Making things happen

About events in SDL 2. How to get the events, how the event structure, SDL_Event laid out, and how we do we handle the event.

Part 5 – Collision detection and our first game!

We learn how to check for collisions and make a simple game out of it.

Part 6 – Let’s load some textures!

In this part we take a look at SDL_Textures and how to create them from image files ( bmp. ) We also look at how to render SDL_Textures.

Part 7 – Using PNG files

We look at, and set up, SDL_Image library. This is used to load png files which then can be rendered with the transparency layer.

Part 8 – It’s TIME for another update!

Here we look at a new rendering function, SDL_RenderCopyEx. The function lets us render textures rotated. We use it to make a simple analog clock.

Part 9 – No more delays!

Up until now we’ve used SDL_Delay to limit framerate to ~16 FPS. We look at how to render using a delta time.

Part 10 – Text Rendering

Text rendering in games can be tricky. Luckily, SDL2_TTF does this for us. This part talks about SDL2_TTF, how to set it up and how to use it.

Part 11 – Text Styles

Now that we know how to render text, we look at how to set various styles like bold, italics, underline and strikethrough. We also quickly look at binary numbers and bitwise operations and use them to manipulate the various style flags.

Part 12 – Multiplayer ( UDP )

In order to get multiplayer functionality, we need to learn about networks / Internet and how it works. This part deals about UDP connections and how use them in SDL_net. It’ll over what you need to know in order to communicate via UDP

Part 13 – Multiplayer ( TCP )

In the previous part, we looked at UDP. This time we take a close look at TCP, see how it solves some of the problems UDP has. We also look at how to use SDL_net to do TCP communication ( without blocking )

C++11 Features

A series about the new features of C++11. I will try to explain everything thoroughly and extensively. The goal is to learn about C++11, how the various parts of it works and why you should use them.

I will cover both minor features like enum classes and larger ones like chrono

Part 1 – Enum classes

This is a very short part about the new version of enums, enum classes. It covers what they are and why you should use them as much as possible

Part 2 – Timing with chrono

This part is very extensive and covers the new timing features of C++11, chrono. It will help you when you’re dealing with timing in games and other applications.

My SDL2 Tutorial part 9 ( No more delays! ) also deals with chrono but this part covers it more extensively.

Part 3 – Smart pointers in C++11

About smart pointers in C++11 ( unique_ptr, shared_ptr and weak_ptr ) what they are, how they work and how to use them. You should always use smart pointers unless you have a really good to.

Part 4 – STL Iterators

About the four major iterator types in C++ ( input iterator, output iterator, forward iterator, bidirectional iterator and random-acces iterator ). We’ll look at what they do and don”t do and how to use them.


819 thoughts on “Blog contents”

    1. Hello,

      Thank you, I’m glad my posts are useful to people. =)

      Yes, actually SDL_net is one of the upcoming posts. I’ll be going through both TCP and UDP, pros and cons of each and how to use them. I hope to get around to it soon.

      Thanks for the tip, I’ll check it out when I’ve got the time

  1. Thank you so much. I really like your blog. Simple, clean and the codes work. I hope you share more especially toward real projects with using OOP. Sad I can’t use some of C++11, because I got stuck with visual studio 2010.

    1. I’ll see what I can do. I’ve been kinda busy lately, starting a new job, moving halfway across the country and stuff.

      For OOP stuff, it’s very usefull to experiment and try to write your own project from scratch. I might write a little about it in the future, but I have a few other tutorials I want to finish first.

      Why are you stuck with 2010? I think you can get free versions of every VS versions, including the newer ones.

  2. I’m learning SDL2 using CodeBlocks/MinGW on Windows, but would like to use OpenGL3 whenever possible..

    Can an SDL2 window that has rendered a texture containing shape primatives and/or images, also contain an OpenGL3 elements? Or because of the way it renders, you have to have separate windows for OpenGL3 and SLD2?

    It’d be nice to do draw a rectangle/text/png using pure SDL2 and pure OpenGL3 on the same window for comparison!

    Do you have any plans for making a simple ‘Hello World’ application using SDL2 and OpenGL3? For example how to setup ‘Glut’, ‘Glew’ or ‘glLoadGen’.

    1. Hello!

      I’m not completely sure about this as I haven’t tested it. But it sounds to me like it’s possible. I think the results will be more or less identical, though. Only that drawing is a lot simpler in SDL ; )

      SDL2 + OpenGL 3/4 will probably be my next tutorial. I really miss working with OpenGL, and setting up a rendering context using SDL2 is quite easy. This is a quick guide on how to set it up, it should help you on your way. ( 1.3 is the same as SDL2, it was just called 1.3 before it was properly released. )

  3. I would also appreciate a way that two directed edges in opposite direction are drawn without overlapping. Is there already a way to do this? Or is it possible to get the path object of Raphael to customize it?Thanks in advance!

  4. Undefined symbols for architecture x86_64:
    “EventHandler::Update()”, referenced from:
    Update() in main.o
    “EventHandler::IsKeyDown(int) const”, referenced from:
    UpdateModel() in main.o

  5. Thumbs up for your time and efforts. I truly appreciate your efforts and I am waiting for your next post thank you once again. If you are also Canon device user and facing some glitches. Dial canon customer support number and direct consult with the Canon support team. Canon expert are available all the time. Canon Printer Technical Support

  6. If changing a port or cable fixes the issue, you know what to fix. If it didn’t make a difference, chances are that it is the printer itself. If you have checked the driver, the mains cable, Windows settings, and network settings, the only thing left is the printer itself and I’m afraid I can’t help you there!

  7. When the HP Envy 4520 printer says offline in windows 10 because printer wireless system is not working properly or there might be computer related issues.

  8. I needed to thank you for this incredible read!! I certainly getting a charge out of each and every piece of it I have you bookmarked to look at new stuff you post.

  9. I am extremely impressed thanks for sharing all information. It is a great post for the people to get the proper information. If you’re facing any technical issues with it, our HP Printer technical executives are much trained to apply the right technical instructions to install HP Solution Center in the right ways. 

  10. Looking for a solution to fix the canon printer won’t connect to wifi error? Then get immediate help from our highly educated and skilled techies. They will provide you the best solution and resolve your error within the shortest time span. For more information visit our website canon printer offline.

  11. This design is steller! You most certainly know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!


    XRumer is the best program for advertisement!
    It’s have CAPTCHA recognizer, email verificator, and a lot of other functions…

    This software will help to increase traffic to website to hundreds, thousands times.
    Program have a rich seven year history, which use experience of professionals in search engine optimization.
    Appreciate and use a truly unique and powerful XRumer program, can both professionals and beginners.

  13. Download Ring App
    The Ring Doorbell is the latest way to help create your smart home. In a world of quickly advancing technology, there are so many ways that you can arm your home to protect yourself.

  14. Hello! Someone in my Facebook group shared this site with us
    so I came to check it out. I’m definitely enjoying the information. I’m bookmarking and
    will be tweeting this to my followers! Great blog and terrific style and design.

    Also visit my web blog paper (

  15. Качественные препараты для повышения потенции Для усиления твердой эрекции и продление полового акта. У нас можно купить таблетки Виагра, Сиалис, Левитра и другие мужские и женские возбудители для секса. Доставка по Киеву и по всей Украине – анонимная. Вся продукция сертифицирована

  16. Howdy very cool web site!! Man .. Excellent .. Amazing ..
    I will bookmark your site and take the feeds additionally?
    I am glad to find so many helpful information right here within the post, we need work
    out more strategies on this regard, thank you for sharing.
    . . . . .

    Also visit my web-site; promo []

  17. I loved up to you will receive carried out proper here.
    The cartoon is attractive, your authored material stylish.
    however, you command get bought an edginess over that you wish be handing over the following.
    sick no doubt come more until now again as exactly the same nearly very frequently inside of case you shield this hike.

    my web-site: promo (

  18. Hmm it looks like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to the whole thing. Do you have any helpful hints for beginner blog writers? I’d really appreciate it.
    web page SEO website promotion website promotion on the Internet

  19. I just like the valuable info you supply on your articles. I will bookmark your blog and check once more here regularly. I am quite certain I’ll be informed plenty of new stuff right right here! Best of luck for the following!
    homepage order website promotion website promotion in Kiev

  20. Hi! I could have sworn I’ve visited this site before but after going through many of the articles I realized it’s new to me. Anyways, I’m certainly pleased I discovered it and I’ll be bookmarking it and checking back often!
    web site website promotion price seo

  21. Right now it looks like Drupal is the top blogging platform out there right now.
    (from what I’ve read) Is that what you’re using on your blog?

    My webpage … essay writing topics (

  22. That is really attention-grabbing, You are a very skilled blogger. I have joined your feed and stay up for in quest of extra of your magnificent post. Additionally, I have shared your web site in my social networks
    играть в Космолот онлайн на гривны

  23. Wow that wass strange. I just wrote an really long comment but after I clicked submit mmy comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyway,
    just wanted to say excellent blog!

  24. Hey there! Someone in my Facebook group shared this site with us so
    I came to check it out. I’m definitely enjoying the information. I’m bookmarking
    and will be tweeting this to my followers!
    Great blog and terrific design.

    Here is my blog post; code []

  25. I’m impressed, I have to admit. Seldom do I come across a blog that’s both equally educative and amusing, and without a doubt, you have hit the nail on the head. The issue is something not enough people are speaking intelligently about. I am very happy I came across this in my search for something relating to this.