Introduction – What is DBGL?
DBGL is third party plug-in for DarkBASIC Professional. It is both a replacement 3D engine and an OpenGL wrapper for calling OpenGL API functions natively from within DarkBASIC Professional. DBGL is also a hub for future, more game-genre specific engines and third-party add-ons.
Why use DBGL?
DBGL is a package aimed at intermediate to advanced 3D graphics and game programmers that use DarkBASIC Professional. It overcomes many problems of the existing DarkBASIC Professional 3D engine by giving the programmer as much or as little control over the graphics pipeline as is desired. At the lowest level, the programmer may take complete control and program entirely using OpenGL API calls. At the highest level the programmer can use the included scene graph and utility functions to have 3D data managed and rendered automatically for them.
DBGL Features
The main DBGL features include:
- Wrapper for the most common OpenGL API functions
- LOD terrain system
- Advanced, flexible particle system
- Full set of 2D commands + compact 2D game engine
- Utility library for common functionality (e.g. setting up OpenGL, loading and rendering meshes)
- Complete set of collision functions
- All the usual trimmings!
The package comes complete with documentation that seamlessly integrates with your existing DarkBASIC Professional installation to provide full syntax highlighting, tool tips and context sensitive help for every command in the library. There is two comprehensive sets of tutorials; one that teaches OpenGL and the other, DBGL.
The DBGL system makes full use of the TPC SDK to obtain a handle to the program window and initialise OpenGL. DBGL works side-by-side of Direct3D and thus can operate just as fast as or even faster than the actual DarkBASIC Professional 3D engine.
The complete package is still several months from completion. In the mean time, here are a couple of screenies of DBGL in action!
LOD Terrain
The terrain system utilises GeoMipMapping for LOD and octree frustum culling to cull off-screen terrain segments (the middle terrain of the images on the right shows the bounding boxes of the octree used in the main image). Each terrain can have up to 4 textures overlaid (although the terrains in this shot only use two). Multi-texturing is used where supported with multi-pass rendering fallbacks for hardware with less texture units.
DBGL Montage
The main image here shows the source code to a small program and the resulting application running in a small window. In this instance the program is from one of the OpenGL tutorials that demonstrate rendering a single triangle in OpenGL immediate mode. Notice the syntax highlighting and tool tip on the new functions.
The image in the top right shows the 'Miko' model with the DBGL cartoon shader applied. There are several special effects that may be attributed to objects easily in DBGL and an infinite number that can be added using native OpenGL calls.
The final image is that of a complete 3D minesweeper clone built during early development of DBGL. It was released to the RGT moderating team a while ago for testing. It demonstrates some of the cool things you can do with OpenGL including object picking using the selection buffer and vertex colour animation.