OpenGL supporting libs

Started by
14 comments, last by Chris_F 10 years, 2 months ago
( for those who do not want to read the whole post... just take a look in bold text smile.png )
After studying a bit about OpenGL and GLSL , I decided to put this knowledge into practice .
I found good tutorials to start such as opengl-tutorial.org and www.arcsynthesis.org/gltut/.
Also put my hands in OpenGL Superbible and almost finished reading it.
However each tutorial uses a different set of helper libraries (for loading images, event handling, managing windows , etc. )
I prefer to use the minimum libraries as possible, so did the whole treatment of windows and events handling using the native windows API.
In this case I was practically forced to use the ' glew ' because the OpenGL extensions are not provided by windows "gl.h" header ( I dont know if its the same thing in Mac or Linux).
Now I'm running into a problem trying to load images. While I'm working with BMP file format that's fine ( I wrote my own function to load BMP data ). However loading images from other formats ( PNG , TGA , JPG , etc ) is not so simple.
In this case I realize that running from third-party libraries will not work. So , I wonder what would be the most appropriate libraries to use with OpenGL ( 3.0 + ) .
I've seen setups using "SDL + OpenGL", "SFML + OpenGL" , "GLFW + OpenGL" or a mix of it all .
So, what would be a good 'toolbox' to a simple OpenGL project??
for example:
Window and Event handling : SDL, GLFW, SFML
Mathematics : GLM
Uploading Photos : DevIL
Charging Models : Assimp
ps: I did some research in this forum, but I don't find recent topics about it... the newest I found was dated from 2006... so I think that a new topic was necessary...
Thanks for any advice.
( and sry if my english is not good )

KrinosX

Advertisement

I dont recommend GLFW, except for a really small project.

If you need an extension loader, consider GLLoad. (GLEW didnt work out for me so well.)

http://glsdk.sourceforge.net/docs/html/group__module__glload.html

For math, use GLM unless you're not using C++ or know you absolutely need something a different library uses. GLM seems as close to universally used as anything gets in OpenGL.

For Windows handling, I'd recommend SDL or SFML (not GLFW). Probably SDL if you're more C-like in your coding, and SFML if you're more OO.

For extensions, I'm using GLLoadgen since I prefer a c/h pair of files instead of an entire library and all that. It doesn't matter what you use though, they just use different init functions and then are the same.

For images, don't use DevIL. It's not maintained, so you'll run into trouble whenever you deviate from "normal" at all. You can use ResIL which branched off of it if you want basically the same thing. You can use libPNG like tons of people do. You can use stb_image if you prefer the simple c/h pair of files again. Once an image is a texture, you don't care how it got there though. So it doesn't really matter which image library you use as long as it works.

For models, I'd think that's more personal preference than anything. You can even load by hand pretty easily, although there's no reason to bother.

So... may I consider using : "SDL + OpenGL3.0 + glm" to a 'mid to big' project? I think SDL come with some image loading extensions.. right?

KrinosX

I like FreeImage for loading images (DevIL is nice too but less features), and glew is basically must-have. glm seems nice but I don't have hands on experience. SDl is generally pretty decent and adds a lot of useful core functionality. On the other hand, I found that Assimp seemed to have a lot of bugs and both GLFW and SFML seem dicey to me.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

So... may I consider using : "SDL + OpenGL3.0 + glm" to a 'mid to big' project? I think SDL come with some image loading extensions.. right?

Yes, SDL has an image library. I think SDL2 is still using libPNG 1.5.7 instead of 1.6.9, but if it works it works. And it will obviously have a wider feature set than libPNG.

Your choices should be absolutely fine. (I am assuming you'll be using SDL2 for SDL. While SDL 1.x is fine today, I have no idea how well it would be supported by the end of your project)

why is the use of GLFW so discouraged? It's a light library that do only the bare minimum for window and input management, good for who don't want an entire framework like sfml. Or not?

For image loading I use SOIL, which is pretty good, light and simple in my opinion (and thinked to work with opengl).

I used GLFW for a month. Ive found at least 3 annoying bugs and things that were done in a very unprofessional way. Like it didnt choose the proper window mode(WS_POPUPWINDOW / WS_POPUP) and my FPS dropped considerably. The input handling was also weird.

Its fine for a small project though.

There is no reason not to use GLM, it's very good and it is made to go with OpenGL.

I've had no issues with GLFW3. In fact it is my favorite window and context creation library because it is very light weight and does exactly one thing, unlike a lot of the other libraries which try to do everything.

I've had better luck with the FreeImage library, but I would recommend you use it for creating your asset tools. For your actual texture assets you are probably going to be wanting to store things like mipmaps and compressed texture data, so you are better off using a custom texture file format and leaving FreeImage out of your game engine.

Same goes with Assimp. There is no reason to be loading your game models in your game engine from a format like Collada or any other format that requires parsing. Your game engine should be using a custom format that is ready to go.

You can use DDS for images and load them with GLI.

This topic is closed to new replies.

Advertisement