Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Basic OpenGL / SDL 2 app - Source


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Aliii   Members   -  Reputation: 1448

Like
2Likes
Like

Posted 24 April 2014 - 01:35 PM

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.

Attached Files



Sponsor:

#2 Karsten_   Members   -  Reputation: 1714

Like
1Likes
Like

Posted 24 April 2014 - 05:16 PM

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_, 24 April 2014 - 05:16 PM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#3 Aliii   Members   -  Reputation: 1448

Like
0Likes
Like

Posted 24 April 2014 - 05:41 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS