• Advertisement
Sign in to follow this  

Basic OpenGL / SDL 2 app - Source

This topic is 1368 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

Ive tried to use SDL2 recently. Before I use it in my existing projects I wanted to write a basic app that puts something minimal on the screen using the "old" and "modern" OpenGL. It turned out fine, so I thought Im sharing the source. (plus Ive added some comments to it.) I hope Im not posting this to the wrong place.

 

It uses GLLoad to get the GL functions but you can replace it with GLEW or any other library.

 

It works for me on both Linux and Windows.(compiled with GCC, using C++11 standard). ....you have to install/add the necessary libraries to your project of course.

I hope it helps someone to start using OpenGL or SDL.

Share this post


Link to post
Share on other sites
Advertisement

This is a nice example which is not bogged down with any OOP. I will likely refer people to this when they are starting out with SDL2 and GL. Thanks smile.png

 

A small question..

 

Inside main cpp (OLD and NEW) you have the define

#define nullptr nullptr

Is there a reason for this?

Edited by Karsten_

Share this post


Link to post
Share on other sites

Inside main cpp (OLD and NEW) you have the define
#define nullptr nullptr
Is there a reason for this?

Basically not, ....other than my IDE sometimes marks "nullptr" as "undefined variable". This way it sees it as a defined thing.

There are some other weird things in the code like glPointSize( 2000) when Im not even drawing points:) I didnt really review it.

Share this post


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

  • Advertisement