Thread: So many libraries!

  1. #1
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413

    So many libraries!

    Recently it's come to my attention that there are a crap load of graphics/gaming libraries. From what I understand:

    1. LibSDL - basically a cross-platform wrapper for the 2D portion of each OS' native graphics API (like pixel operations, not the more advanced stuff) along with some networking support
    2. Allegro - basically the same as LibSDL minus networking, but with support for sprites, more support for playing sounds...targeted more towards gaming than media...
    3. cairo - just 2D vector graphics, used in Gtk
    4. SFML - basically a C++ version of LibSDL
    5. ClanLib - haven't checked into it yet
    6. OpenGL - just 3D graphics

    Anyone have anything good or bad to say about any of these? Anything to correct? Did I miss any major ones (besides like XNA, talking cross-platform libraries here)?

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by Epy View Post
    Did I miss any major ones (besides like XNA, talking cross-platform libraries here)?
    Thanks though.

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    82
    You're a little confused.

    All libraries are going to be based on OpenGL or DirectX (or I guess in special situations directly interfacing with the gpu/driver or something aside the point).

    ... anything we will ever be using for general graphics will be OpenGL or DirectX. All of those libraries you find are built on top of OpenGL or DirectX, they're just designed to make using OpenGL or DirectX easier.

    Using OpenGL directly for example you need to be a lot* more aware GL states, texture calls, etc etc, where as those libraries you just give some simpler parameters and they do that work for you.

    What's better? Better question, how determined are you, what is your goal, what is your experience level?

    If it's all for the lulz to play around on start with SDL or Processing. (Processing.org)

    If your more serious OpenGL/DirectX and Shader languages like GLSL/HLSL.

    OpenGL is not just for 3d graphics. OpenGL is the industry standard graphics API, DirectX is a dedicated API implemented for use on Windows systems specifically.
    Last edited by since; 12-10-2009 at 11:28 AM.

  4. #4
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by sufoode View Post
    it works if you use an emulator so 2 points for me
    Yes, because it would make more sense to use Wine on Linux machines than to just use a cross-platform library. Totally.

  5. #5
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by since View Post
    You're a little confused.

    All libraries are going to be based on OpenGL or DirectX (or I guess in special situations directly interfacing with the gpu/driver or something aside the point).

    ... anything we will ever be using for general graphics will be OpenGL or DirectX. All of those libraries you find are built on top of OpenGL or DirectX, they're just designed to make using OpenGL or DirectX easier.

    Using OpenGL directly for example you need to be a lot* more aware GL states, texture calls, etc etc, where as those libraries you just give some simpler parameters and they do that work for you.

    What's better? Better question, how determined are you, what is your goal, what is your experience level?

    If it's all for the lulz to play around on start with SDL or Processing. (Processing.org)

    If your more serious OpenGL/DirectX and Shader languages like GLSL/HLSL.

    OpenGL is not just for 3d graphics. OpenGL is the industry standard graphics API, DirectX is a dedicated API implemented for use on Windows systems specifically.
    I understand that (well, libSDL has a windib backend on Windows by default as opposed to DirectX, from what I read). Don't both OpenGL and DirectX work with the video card directly though, hence video cards that support DirectX 10 (11 now) and OpenGL 3.0, etc.?

    If I were to make a 2D game, would there even be an advantage to using OpenGL directly as opposed to libSDL or whatever else (since I wouldn't be using any "advanced" features)?

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Epy View Post
    Don't both OpenGL and DirectX work with the video card directly though, hence video cards that support DirectX 10 (11 now) and OpenGL 3.0, etc.?
    Yes. But only for video cards/chipsets that actually support that, which is not all video chipsets. Eg, via and intel onboard video does not. In that case, the processor does the work the GPU would do.

    If I were to make a 2D game, would there even be an advantage to using OpenGL directly as opposed to libSDL or whatever else (since I wouldn't be using any "advanced" features)?
    [edit]just to make it clear: you can use openGL in SDL for both 2 and 3D.

    Yes. According to everything I have ever seen, even if you want to use SDL for 2D, you should use the openGL 2D API inside SDL because it will be much faster than SDL's native capabilities. I would guess this is because openGL is the hardware library, so GL hardware acceleration takes place if you use it, regardless of whether it is 2 or 3D, but perhaps the whole design is part of the reason. Way more development resources go into GL than SDL.

    In addition to being faster, GL provides more high level routines for 2D than plain SDL, making it easier to code with.

    To give you an example of how drastic this is: I just got an ATI card because I've been working on a FPS breakout and I was down to 20 frames/sec. After I put the card in it went up to over 300 frames/second, and that is not an error. Objects that previously took seconds to cross the screen became just a quick blur of color.
    Last edited by MK27; 12-10-2009 at 04:13 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Thanks MK27, a lot of what I wanted to hear.

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    OpenGL is not just for 3d graphics. OpenGL is the industry standard graphics API, DirectX is a dedicated API implemented for use on Windows systems specifically.
    Backwards. OpenGL does not support input, sound, etc, natively. DirectX does. DirectX is not just a graphics API but Direct3D is the graphics portion of the DirectX API.

    If your more serious OpenGL/DirectX and Shader languages like GLSL/HLSL.
    Shaders are a feature of OGL and D3D and I fail to see how 'serious' or 'un-serious' they make a project. They are a feature and as of D3D10 they are an integral part of the rendering and transformation pipeline.

    I use DirectX b/c there is an entire company (and building on the campus) supporting the API. OGL is not 'officially' supported in Windows as of 1.0 or 1.1. You can still find plenty of information about it for sure so it really comes down to a matter of choice.

    But I do not recommend, in any situation, that you use a higher level API prior to understanding the lower level API. Because it's almost impossible to completely abstract away 2D/3D principles in any API. A higher level API will only be encapsulating the low level behavior. If you do not understand the low level you probably won't understand it at a higher level either.
    Start with raw OGL or D3D by getting a book on either one and having at it. Once you feel you at least understand the basics of vectors, matrices, transformations, coordinate spaces, cameras, etc, etc. then you can take that knowledge and apply it to a higher level API. The high level API's are designed with rapid development in mind but they are not designed specifically to hide the nitty gritty from newcomers even though that is the end result. They hide the nitty gritty b/c the users of the API already know or have done the nitty gritty and no longer want to. It is not b/c they do not understand it. So do yourself a favor and don't worry about what you produce right now and just concentrate on concepts. You will be much more efficient later if your do this. Also many open source solutions do not provide everything to make your game so you will need to design some systems to do specific tasks. In order to do this you will need to understand not only how to do it in raw OGL or D3D but also how to integrate it into a system such as OGRE or Irrlicht or whatever it is you choose to use. There isn't any API out there that will magically make your game for you. These types of applications are often extremely limited b/c they try to hide everything from you.
    Last edited by VirtualAce; 12-10-2009 at 05:36 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GCC: Compiling with both static and shared libraries
    By eatwithaspork in forum C Programming
    Replies: 4
    Last Post: 06-23-2008, 01:48 PM
  2. Replies: 7
    Last Post: 05-13-2008, 03:47 AM
  3. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  4. Libraries and headers
    By darksaidin in forum C++ Programming
    Replies: 10
    Last Post: 07-23-2003, 06:24 AM
  5. QT and external libraries
    By Quacker in forum Linux Programming
    Replies: 1
    Last Post: 04-08-2003, 07:02 AM