An ActiveX control implementing
OpenGL 1.1
(with parts of glut and glaux added)


What does it?

The control provides a straight wrapper of the OpenGL-Api intended for use with Visual Basic.


If have added examples that implement the GLPaperplane example as a standard VB project
and an OCX control.

Paperplane.JPG (16351 bytes)

You can download the source code here: paperplane.zip



The control has only to important events:

The Opengl context is set up properly, when these events are fired.
Don't call these funtion directly; if you want to redraw the control
use the function Refresh

Data Types

OpenGL Visual Basic
Glenum Long
Glboolean Byte
Glbyte Byte
Glshort Integer
Glint Long
Glsizei Long
Glubyte =Byte
Glushort =Integer
Gluint =Long
Glfloat Single
Glclampf Single
Gldouble Double
Glclampd Double
Glvoid =>Interface VoidPointer



Additional Functions


special things

  1. wglMakeVoidPointer(GLenum type, v1() As Variant)
    This takes the data type along with an array of Variants with your data  as arguments
        Dim dp as VoidPointer
        Set dp= GlaxCtl1.wglMakeVoidPointer _
            (GL_DOUBLE, myArrayofVariantdouble)

  2. MakeVoidPointerFromPointer(GLenum type, datapointer as Long, data() as Variant)
    This one is needed for callback functions returning a "naked" data pointer.
    The function converts the data pointed into an array of variants data while returning
    a VoidPointer for further use of the data.
        Dim pData as VoidPointer
        Set pData = Form1.GLaxCtl3.MakeVoidPointerFromPointer _
            (GL_DOUBLE, datapointer, data)

  3. There is now a wrapper for auxDIBImageLoad() called DIBImageLoad() to load DIB images. The use is straightforward:
        Dim vp As VoidPointer
        Dim cx As Long, cy As Long ' image extent
        Set vp = .DIBImageLoad("your.bmp", cx, cy)
        .glPixelStorei GL_UNPACK_ALIGNMENT, 1
        .glDrawPixels cx, cy, GL_RGB, GL_UNSIGNED_BYTE, vp

known problems:

Control and an example program (Visual Basic 6):

Source only:

License Agreement:

Last change on 11/01/01 by K. M. Syring

Click Here!