Thread: Difficulty choosing graphics library

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    Difficulty choosing graphics library

    I am looking for a graphics library for specific features and such. But I am confused as to which to use... I know that there is SDL and Allegro. But I dont know if they do what I want them to do fully...

    I am trying to start writing a game engine and I wanted to be able to include the following options for this graphics library:

    Main feature:
    Code does not need to be changed at all for cross-platform functionality and all the functions still remain the same. Basically, I just want to copy and paste the code, Compile the SAME EXACT CODE under windows, and linux and mac etc... Without modifying anything.

    Platform Portability:
    MUST:
    Dos
    Windows
    Linux
    Mac

    Wishlist:
    Amiga
    Palm
    Pocket PC/Windows Mobile

    For: C++

    Graphics file formats needed (All true color and high color and 256 color support):
    MUST:
    BMP
    GIF
    JPG
    PNG
    PCX

    Wishlist:
    TGA
    ICO
    ICL
    CUR
    IMG
    IFF
    WMF
    TIF
    XBM

    Library Features:
    Just some of the most basic features that a graphics library has. But a MUST is that it can compile in free C++ compilers. I am hoping that maybe the library can also support outputting and converting images to other file formats as well. In other words, open the file in JPG, but then save it in BMP, etc...

    MUST HAVE FEATURES:
    Color adjustments
    Lighting adjustments


    Can anyone help me find something exactly like this? Or is it possible to extend Allegro or SDL to be able to do this? Does something with my wishlist items exist? Thanks in advance for your help...

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    SDL i believe can do almost all of that if you know how to. Color adjustment and lighting is easy to do if you can do pixel manipulation, but the SDL_Image extension library will load most of those image formats. also if you need a good audio library i recommend Irrklang. Best of luck to you.

    Or if you are willing to do it, you can right your engine with DirectX which will be naturally faster than SDL or allegro, but will also be somewhat slower to write.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    2
    I know SDL will work on Windows, Mac and Linux. But I haven't seen a port for DOS and I haven't seen any official ports for other OS's. Allegro seems to be able to be ported to those main OS's, but it seems to lack some of the features I need from it.

    Also, I really want DOS to be supported as a definite because if there is no other port to the other systems, DOS can be run from those systems through an emulator. But even though I would have a dos version, I still definitly want a Mac, Linux and Windows Version...

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    are you talking about MSdos? if that is the case you are going to be very limited, or it may not even be possible to get a completely portable graphics library. I didnt even think that dos had graphics, but i may be wrong.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    DOS allows access to the hardware, so it has graphics, just not code to do it with.
    Last edited by robwhit; 02-21-2008 at 07:56 PM.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Running through an emulator will slow things down to a crawl, so I don't think you want that...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I'd suggest, OpenGL (with glfw) -- I find SDL a bit bloated.

    > Compile the SAME EXACT CODE under windows, and linux and mac etc... Without modifying anything.
    Not even the build flags?

    Why does your engine have to support everything?! This will only make it complex, hard to maintain and bloated as hell. Your engine should support loading of image formats, not necessarily the graphics library -- most mainstream graphics libraries only support 1 image format, the rest is provided by extensions, or extra code.

  8. #8
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    I'd suggest, OpenGL (with glfw) -- I find SDL a bit bloated.
    I wouldent call ~256k bloated considering the OP wants to make a game engine. And if we are assuming the end user has the required DLLs on their system (as you would with openGL) then theres no bloat at all

  9. #9
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I wasn't talking about that bloat... The API is bloated

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I know SDL will work on Windows, Mac and Linux. But I haven't seen a port for DOS and I haven't seen any official ports for other OS's.
    You could always check the web site. http://libsdl.org/
    SDL supports Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported.
    I've never tested very many of those, mind, but I'm sure support is reasonable for them.

    I used to program a lot for DOS, and that was one reason I didn't really want to use the SDL at first, because it doesn't support DOS -- but then I realized that no one really uses DOS anymore. Everyone uses Windows. (Though looking at some of the other "wishlist" platforms you have there, perhaps you really do need DOS support.)

    You could probably port SDL programs to DOS reasonably easily -- there just isn't official DOS support because the SDL includes stuff like threads that wouldn't work under DOS. As long as you use DOS-compatible stuff, I don't think writing your own layer would be that hard . . .

    Besides -- doesn't this clinch it? http://www.ohloh.net/tags/game
    DOSBox uses SDL to emulate the PC hardware required for running old DOS games.
    Or you could just use Allegro, I suppose. I've never really tried Allegro, so you'll have to get someone else's opinion on that.

    [edit] Found this SDL under DOS thread if it's of any help: http://www.pearpc.net/viewtopic.php?f=10&t=2424 [/edit]

    [edit=2] More info:

    So it looks like you could run SDL programs under DOS if you wanted to. Or you could just use Allegro -- but it doesn't have threads, apparently . . . . [/edit]
    Last edited by dwks; 02-27-2008 at 01:59 AM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Again, why bother with DOS? It will hurt more than it will help.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Trying to support DOS and Win32 in the same engine is next to impossible and will only serve to obfuscate your code. You will most likely need two separate engines or code lines to accomplish this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best Graphics Library for 2d RTS?
    By arew264 in forum Game Programming
    Replies: 4
    Last Post: 04-18-2007, 12:05 PM
  2. Graphics Programming :: Approach and Books
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 05-11-2004, 08:33 PM
  3. Need some help choosing a good graphics library
    By dead_cell in forum Game Programming
    Replies: 31
    Last Post: 01-08-2003, 01:30 PM
  4. Choosing the right graphics card
    By biosninja in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 10-22-2002, 10:13 AM
  5. Windows Graphics Library?
    By drdroid in forum C++ Programming
    Replies: 5
    Last Post: 09-09-2002, 07:46 PM