Sign in to follow this  

What does graphic libraries do?

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

Hi! I hear alot of talk about graphic libraries, such as allegro, or SDL, but I have never really understood what they do. Do they add new commands that make graphics programming easier? Or do they just expand what is there, so that more complex things can be achieved. I would really like to know what graphic libraries bring to the table, and whether they are worth looking into. Thanks.

Share this post


Link to post
Share on other sites
Everyone uses a graphics library. You need one. But, Allegro and SDL are game libraries, not just graphics libraries. They include stuff for reading from unput devices, and playing sounds, making graphics etc...

I can recommend Allegro. I have used it in the past, and it's very easy to use. I have never used SDL so I can't comment on it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Vampyre_Dark
Everyone uses a graphics library. You need one. But, Allegro and SDL are game libraries, not just graphics libraries. They include stuff for reading from unput devices, and playing sounds, making graphics etc...

I think a game library is defined as a library that has game functionalities built into it such as sprite engine, collision detection, physics, etc. SDL and Allegro are not game libraries because they don't have these characteristics. They are libraries, but more than just graphics libraries because like you said they include reading input devices, sounds, and networking.

OP:
They don't add new commands. They just handle things differently. SDL functions are different than Allegro functions. How you set them up is also different. That's why when it comes to choosing a library it usually comes down to personal style. They do the same thing: draw pixels on the screen, but how you do it is different. Direct3D and OpenGL (what usually people ask) also do the same thing, but the difference lies in how you use them.

Share this post


Link to post
Share on other sites
Quote:
Original post by alnite
I think a game library is defined as a library that has game functionalities built into it such as sprite engine, collision detection, physics, etc. SDL and Allegro are not game libraries because they don't have these characteristics. They are libraries, but more than just graphics libraries because like you said they include reading input devices, sounds, and networking.


Quote:
Allegro is a game programming library for C/C++ developers distributed freely, supporting the following platforms: DOS, Unix (Linux, FreeBSD, Irix, Solaris, Darwin), Windows, QNX, BeOS and MacOS X. It provides many functions for graphics, sounds, player input (keyboard, mouse and joystick) and timers. It also provides fixed and floating point mathematical functions, 3d functions, file management functions, compressed datafile and a GUI.


Anyways. C and C++ alone don't have any 'commands' for graphics, or reading joystick input. It has very little on it's own, no concept of graphics or sounds, or input. That is stuff you have to create yourself, for the platform you are programing under. That's why you would use a library for that stuff. Such as OpenGL, DirectX, Allegro, SDL, Clanlib etc.. If you want to look up allegro, try alleg.sf.net, and www.allegro.cc. I think SDL is at libsdl.org, but not sure.

Share this post


Link to post
Share on other sites
Hm, maybe it's called game programming library because it's used for game programming, but it's not necessarily a game library. I am thinking something along the lines of Doom engine or Torque engine. Those two already incorporates everything you need to make a game: physics, loading models, etc, and Allegro and SDL do not have those.

Share this post


Link to post
Share on other sites
Quote:
Original post by Major Payne
So what a graphic librarie does, is allows for easier access to graphics, so that instead of setting up all the code for input it allows you to cut to the actual input itself?


well, technically a graphics library has nothing to do with input. SDL stands for Simple DirectMedia Layer. It is a lower level library which can handle input, window creation, bitmap loading, and 2d drawing to the screen. Allegro probably offers more then the base SDL library, but there are add on SDL libraries, such as SDL_mixer (for sound) and SDL_image (for different format image loading) which can be used with SDL to extend the basic functionality. ive never used Allegro, but id bet it has all of this stuff (and probably a little more) in a single library.

anyway, a library supplies you with a set of functions which allows you to accomplish things much more easier then by hand. for example, SDL gives functions to create a window, load an image, draw an image to a screen, etc. this is how you can make a game, calling these functions to draw images to the screen, while taking input and playing sounds and stuff.

Share this post


Link to post
Share on other sites
I suggest reading this article along with this one (in that order).

These two explanations helped me to understand what libraries do for a programmer.

Basically, programming libraries allow you (the programmer) to tell the computer what to do faster and easier (in most cases).

An analogy:

You want your friend to know it's your birthday tomorrow.
He lives 500 miles away from you.

With out a library, you will have to walk the entire distance and tell him face to face.

However, you just received a library from your mother to help you in your communication problem. This library is in the form of a car. Now the time to tell him the message will be shorter. And getting to his house will be easier.

But before you go, you find another library under your couch. This library is in the form of a phone. Now you don't have to travel any distance. You only need to pick it up, dial his number, and talk into the mouthpiece.

Share this post


Link to post
Share on other sites

This topic is 4861 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this