Sunday, September 12, 2010

Graphics library

FreeBASIC has a built-in 2D, QuickBASIC compatible, software graphics library known as FBgfx (or Gfxlib), which provides the user with simple graphics primitives (such as rectangles, lines, and circles), blitting, and additional features which weren't present in QuickBASIC's graphical library. The library simply wraps the backend renderer. It uses OpenGL on GNU/Linux and DirectX on Microsoft Windows. Although, the library can be forced to use OpenGL under Microsoft Windows. This abstraction makes the built-in graphics library to be portable across platforms.

Although the library is built-in, it is only included if one chooses to use it, which is done simply by including a call to the FBgfx Screencommand. Using common libraries such as OpenGL and creating a window with an API (Microsoft Windows, GNU/Linux, etc.) for hardware acceleration can be used without interfering with the FreeBASIC graphics library.

An alternative to the built-in graphics library is Cairo which has an edge to being able to render vector images as well as raster images.Quixie, a game engine written in FreeBASIC, is primarily using Cairo as its renderer but it also utilizes the built-in graphics library to loadBMP, JPEG and TGA image files that Cairo couldn't load.

No comments:

Post a Comment