Hardware accelerated  graphics using  Open GL

Open GL is arguably the best designed library for mulitple languages. I reworked the port of the OpenGL DLL so RapidQ can take use of the 1.1 specification. OpenGL is a rich library of commands that draw graphics to a QForm. However, it can draw to several Windows 'device contexts' like a QCanvas and a QBitMap..

There are many tutorials on how to use OpenGL, it uses a systematic naming convention. All commnads and variables start with 'gl' then have a command, then end in a suffix to let you know what variable to pass. The easiest way to learn is just play with some simple examples and then you will get the idea.

The code in this page uses an inlcude file (QGL.inc) to help generate the grahics form for OpenGL.  At right is a 3D box with a texture map that rotates in fog. Also the GUI allows you to see 2D and a gluSphere object

A good OpenGL tutorial is at www.GameTutorials.com, which is a great site for programming infomation, not just games.


RapidQ Source code:
GL  include file:
GLU  include file:
RapidQ OpenGL helper include file:
Download OpenGL programs (2.2M)

Details:
Textures are handled by a QBitMap. Dimensions of the textures should be a power of 2 (64 x 64, 128 x 128, etc.). There used to be several old OpenGl files for bitmaps, but they are not needed anymore. Thanks to Don Geo67 for sharing some code.
Open GL particle generator

Open GL allows alphablending for producing 'particles.' In this example, a little blur spot is painted all over (like sprites) the screen, but they have semi-transparent portions. The particles move to produce a rocket ship like fire blast. Read the code to see how key presses make the particles change.


RapidQ Source  code:
Download OpenGL programs (2.2M)



Details:
This is a port of the popular GameTutorial and HeNe tutorial of the openGL particle engine. Also see  Basic4GL.
Move an object by the mouse and button clicks.


Don Geo67 wrote a similar program for HotBasic, and I just ported it to RapidQ.


RapidQ Source code:

Download OpenGL programs (2.2M)


Details:  RapidQ makes GUI and event handling so simple! There is no need for the OpenGL GLUT library. I won't miss the required functions and pointers.
MD2 Quake 3D model animation, and animation set.


Very nice 3D animation can be made in RapidQ. This is largely a port of the FreeBasic MD2 viewer. However, there are two versions, this one loads quicker, views the entire animation, but renders kind of slow

MDviewer


And this version takes a long time to load BUT, you can render the part of the whole animation fast (> 30 frames/second) by storing the OpenGL commands in a display list. The speed difference is amazing. If you know what you are doing you can make a total replication of the QD3DScreen component in RapidQ using OpenGL, including QD3DanimationSet


MD_animation

Download OpenGL programs (2.2M)





Details:
You can find MD2 models all over the internet. Textures must be converted to 24-bit bmp or jpeg (with jpeg.dll). They must be resized to a power of two in dimension.
Made with Nvu