BlitzGL

The BlitzGL module provides a set of easy to use commands for creating and manipulating OpenGL contexts, for 'raw' OpenGL programming.

Once you have an OpenGL context, you can use any of the OpenGL commands.

The functions in this module serve a similar purpose to the 'wgl' and 'glx' libraries found on the Windows and X-Windows platforms.

In addition, BlitzGL provides some helper functions for converting pixmaps to textures and for simple text rendering.

Function reference

bglDisplayModes( buf:Int Ptr,size )   Get available display modes

Returns: Number of available display modes

The region of memory pointed to by buf is filled with a series of 16 byte [width:Int,height:Int,depth:Int,hertz:Int] structures. No more than size bytes are written to buf.


bglCreateContext( width,height,depth=16,hertz=0,flags=BGL_FULLSCREEN|BGL_BACKBUFFER|BGL_DEPTHBUFFER )   Create GL context

Returns: True if successful

flags can be any combination of:

Flag valueEffect
BGL_FULLSCREENCreate a full screen context
BGL_BACKBUFFERCreate a context with a backbuffer
BGL_ALPHABUFFERCreate a context with an alpha buffer
BGL_DEPTHBUFFERCreate a context with a depth buffer
BGL_STENCILBUFFERCreate a context with a stencil buffer
BGL_ACCUMBUFFERCreate a context with an accumulation buffer

To combine multiple flags, use the | operator.

bglDeleteContext( context=0 )   Delete GL context

By default, deletes current context.


bglSetSwapInterval( interval )   Set GL swap interval

Returns: True if successful, else false. Not all OpenGL drivers may support this function.


bglSwapBuffers()   Swap GL buffers

The current OpenGL context must have been created with the BGL_BACKBUFFER flag.


bglSetMouseVisible( visible )   Show or hide GL mouse pointer

bglFixedFontBitmaps()   Create GL font bitmaps

Returns: Base display list name containing first glyph


bglAdjustTexSize( width Var,height Var )   Helper function to calculate nearest valid texture size

This functions rounds width and height up to the nearest valid texture size


bglTexFromPixmap( pixmap:TPixmap,mipmap=True )   Helper function to create a texture from a pixmap

Returns: Integer GL Texture name

pixmap is resized to a valid texture size before conversion.


bglDrawText( text$,x,y )   Helper function to output some simple 8x16 font text

Draws text relative to top-left of current viewport.

This function is intended for debugging purposes only - performance is unlikely to be stellar.


Module Information

Modulebrl.blitzgl
Version 1.01
Author Mark Sibly
License Blitz Shared Source Code
Copyright Blitz Research Ltd
Modserver BRL