Libraries

Started by
10 comments, last by Daaark 18 years, 10 months ago
Even for games using only 2D graphics, its better to use OpenGL or Direct3D. The reason is that you want to off-load as much of the graphics processing and image data onto the GPU and video memory as possible. Most computers are equipped with a 3D graphics card these days, so it makes sense to do this.

I don't know for certain how SDL handle's surfaces, whether they allocate memory from VRAM or general RAM. But lets say in a double buffered scheme, it draws on a surface in general RAM. Then every time it updates the screen, it must blit through the System/AGP bus to the video buffer on the graphics card.

So lets say you represent a sprite as a rectangle polygon with the sprite image as the texture. With these 3D APIs such as OpenGL, you can put sprite textures into VRAM, and you can compile instruction lists to move and transform these rectangles, which the GPU can process on its own. This way, all the graphics processing happens in the video card where it belongs, and you can free your system bus and dedicate your CPU to other important things. (Please correct me If I said anything wrong here. I'm still learning this stuff.)

If however you're doing 2D demo effects, or graphics processing where you would be changing or moving individual pixels in an image or video surface, then SDL is fine. SDL is also great for wrapping all the other DirectX elements such as keyboard, mouse and joystick handling and sound. Combined with OpenGL, you have a very good game library in a simple C interface.


Advertisement
Quote:Original post by chad_420
Allegro is a great begginers 2d graphics/game library though it is getting a little dated. In dev-cpp goto tools menu then package something or other and ittl let you download and install libraries like SDL, directx8, and allegro at the click of a mouse.


Chad speaks the truth. :) Allegro is good, and VERY easy to use.

www.allegro.cc

This topic is closed to new replies.

Advertisement