Overview
What you need
OpenGL is a low-level graphics API implemented in 2
dlls. There are 2 versions of these dlls, Microsoft's and SGI's. The MS dlls are
named 'opengl32.dll' and 'glu32.dll', the SGI dlls are named 'opengl.dll' and
glu.dll'. If you use NT, you have the MS dlls; if you use W95, you may need to
download them from the MS web site. The SGI dlls are no longer supported, but
can be obtained from www.opengl.org.
To use OpenGL from Visual Basic, the only thing necessary is a type
library. You can download a free type library from this site, for both the MS
and the SGI implementation of OpenGL. Download and install either or both of the
type libraries and you will be able to call OpenGL functions directly from VB.
Beginning with OpenGL
If you are new to OpenGL, you must next collect the necessary documentation and
support files. These are:
The Platform SDK - available on
the MS website, the 'Graphics and MM' section.
The
'OpenGL Programming Guide' (the 'Red Book') - at bookstores or Amazon.
GLUT - a free cross-platform library with lots of sample
code.
You'll probably also want
to get one of the books on using OpenGL in Windows.
Using OpenGL with VB
Most of the publicly availabe OpenGL samples and tutorial materials make use of
Mark Kilgard's GLUT library, but the Win32 version of GLUT 3.6 is not fully
compatible with Visual Basic. You can instead download 'glxCtl', a generic
OpenGL ActiveX control written in VB5. The control handles the setup of the
OpenGL window and fires various events. The glxCtl is structured so that GLUT
samples can be easily ported to Visual Basic. It includes VB versions of the
GLUT shape routines (Solidxxx, Wirexxx) and a port of the GLE Extrusion library.
It also provides at least minimal support for palettes, bitmaps and rgb image
files. The ActiveX control is required by most of the samples on this site, but
is not otherwise necessary for OpenGL programming, and is distributed with
source code.
Sample code
There are numerous samples and tutorials for OpenGL available on the web. The
samples on this site are mostly ports I did while testing the type library. So
far as I know, all OpenGL functionality is available to VB, but there are
differences between C and VB you need to be aware of. One of these is array
ordering - be sure to read the 'Questions and Answers' page and the page on
porting C samples if you wish to save yourself some grief. You'll find a lot of
sample code here illustrating how to use OpenGL with VB, and more as I collect,
port, and write it. Several tutorials explain various aspects of using OpenGL
from VB, but I make no attempt to explain OpenGL itself, nor can this knowlege
be obtained from the code samples. If you are new to OpenGL, you will need to
get 'OpenGL Programming Guide' and 'OpenGL SuperBible' and visit the many OpenGL
sites on the web for more information. If you have questions you are welcome to
send them in. If you have written some OpenGL samples, please contact me so I
can provide a link to your site.
Please send suggestions, bug
reports, and such to: