• Advertisement
Sign in to follow this  

Want to move onto a graphics library

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

Hello all,

 

I've just joined the site so I hope that I am posting in the correct forum. If not, then I am terribly sorry for the trouble.

 

I have a question for those who are wise about programming libraries like DirectX, SDL and OpenGL. I have been programming in C++ for almost 4 years now and understand the basics, including the STL. I have picked up a book on DirectX and SDL and understand the code inside them. I think I am ready for moving onto a library to begin using graphics. I also know and understand how to build a Window using the Windows API.

 

My question is this: What library is the best (not so much easiest) to begin with? I have no hopes of designing a game. I just wish to mess around with the graphics, input, sound, etc. so I obtain a better understanding of how it works and how to write it.

 

Thank you,

 

Lewis

Share this post


Link to post
Share on other sites
Advertisement


My question is this: What library is the best (not so much easiest) to begin with? I have no hopes of designing a game. I just wish to mess around with the graphics, input, sound, etc. so I obtain a better understanding of how it works and how to write it.

 

Based on this, you want a multi-purpose library, and not just a graphics library.  OpenGL is purely a graphics library, so doesn't handle sound and input.

 

DirectX can handle all of these, but then you're limited to Windows only.

 

There are three widely used cross-platform libraries: SDL, Allegro, and SFML.  The first two are C libraries, and SFML is C++. They all have similar APIs and learning curves.

 

The best for you depends on what you want.  If you don't care about cross-platform and are using Windows, then DirectX is probably the best choice as there is a great deal of documentation for it, both online and in book form.  If you do want cross-platform support, then it depends on if you want a C++ library or a C library.

Share this post


Link to post
Share on other sites

I am a beginner in this field so I am just learning. In my C++ course I was always told that once you have one language down then others follow easier. Isn't this the same for libraries? If so, I am not that worried. I just want to get some knowledge to one day create a VERY basic game.

 

Thank you for your reply,

 

Lewis.

Share this post


Link to post
Share on other sites

You can use the C libraries in C++. In fact I use Allegro myself with C++.  Some people just prefer a library that was built with C++ in mind from the ground up.

Share this post


Link to post
Share on other sites

I am a beginner in this field so I am just learning. In my C++ course I was always told that once you have one language down then others follow easier. Isn't this the same for libraries? If so, I am not that worried. I just want to get some knowledge to one day create a VERY basic game.

 

Thank you for your reply,

 

Lewis.

That's very true.

 

Allegro, SDL and GLFW cover what you need. Any of those would be suitable.

 

My 2cc: use SDL2.

 

Moving to any other library will be trivial once you get the hang of it.

Share this post


Link to post
Share on other sites

Thank you very much for the information. May I ask one other question?

 

How do I include the .lib files to Visual Studio for SLD2?

Share this post


Link to post
Share on other sites

In your project properties (alt-enter), under Linker / Input / Additional Dependencies

Share this post


Link to post
Share on other sites


Based on this, you want a multi-purpose library, and not just a graphics library.  OpenGL is purely a graphics library, so doesn't handle sound and input.

 

I just wanted to note that OpenGL and SFML work nicely together however(or glfw, if you want another option), and the sound/input parts of SFML are rather easy to implement(same goes for glfw). So, I'd say to not let this deter you too much from OpenGL.  Between the three you really have most of the basics covered I think. If you are looking for a cross-platform and open source library, I still think OpenGL is a pretty viable option for you.

Share this post


Link to post
Share on other sites

 

How do I include the .lib files to Visual Studio for SLD2?

#pragma comment(lib,'SDL2.lib')
#pragma comment(lib,'SDL2main.lib')

 

Pasted into my Evernote. Thank you.

Share this post


Link to post
Share on other sites

 

 

How do I include the .lib files to Visual Studio for SLD2?

#pragma comment(lib,'SDL2.lib')
#pragma comment(lib,'SDL2main.lib')

 

Pasted into my Evernote. Thank you.

 

 

Don't use it in code you want anyone else to compile, as that will only work with MSVC.

Share this post


Link to post
Share on other sites

How do I include the .lib files to Visual Studio for SLD2?

#pragma comment(lib,'SDL2.lib')
#pragma comment(lib,'SDL2main.lib')
Pasted into my Evernote. Thank you.
 
Don't use it in code you want anyone else to compile, as that will only work with MSVC.

True but he said visual studio explicitly. Ironically I edited my post removing "windows only" for this very reason. Lol

Share this post


Link to post
Share on other sites

Starting to learn DirectX and looking into SDL. I am taking in a step at a time, looking up 2D graphics creation at the moment. I have finally got a window with a picture on it. Now, I just need to know how to develop sprites then use them in the program. Doesn't sound difficult now, does it...?

Share this post


Link to post
Share on other sites


True but he said visual studio explicitly.

 

I just wanted him to be aware that while it might work for him while using VS, if he gave the code to someone else to compile, it might not work for them.

Share this post


Link to post
Share on other sites

 


True but he said visual studio explicitly.

 

I just wanted him to be aware that while it might work for him while using VS, if he gave the code to someone else to compile, it might not work for them.

 

True but I think the pragmas are ignored by other compilers but have the added benefit to sort of self-document all required libs whereas IDE configurations etc get lost in translation and he would have to reconfigure his different IDE with whatever that uses to find libraries anyway, whether the pragmas are present or not.

Share this post


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

  • Advertisement