Code Template for OpenGL _Win32 on Free Basic Compiler

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
Glu

Code Template for OpenGL _Win32 on Free Basic Compiler

Post by Glu »

Here's a code template that I made which can be used and re-used to open up a window for OpenGL thru the Win 32 Api in Free Basic.

It's fast!


Just put your straight forward OpenGL code in the RenderScene Function. Maybe, pre compile your objects in the Init Function, for a speed increase and then, update the keyboard and objects thru the UpdateScene Function.


Re-use the rest of the code over and over again for all your OpenGL projects and add functions as you improve.

Just use those three functions for your OpenGL code to start you up in your 3D programming journey.

Download Free Basic Compiler http://www.freebasic.net


Free Basic OpenGL Win32 Window Template:
http://www.gameroom.com/glu/FbGlWin32e.html


Other Templates:

Free Basic OpenGL Win 32 Spotlight :
http://www.gameroom.com/glu/FbGlWin32Spotlight.html


1. Download your FB compiler and install into your root C: Drive preferably.

2. Copy and paste the template's code in MS Notepad.

3. Save file as "Template.BAS" into main FB folder. Include the colons too, so you can change the extension from an ordinary .txt file to a .BAS file.

4. Pull up the MS DOS Console.

5. After you have changed the console's focus to you main FB folder with something like so:

cd c:\FreeBASIC (meaning, change drive to C and focus to main FB folder.)

6. Then, Compile Template.BAS into a stand alone executable and type at the console :

fbc -s gui Template.BAS


Thats all there is to it. FB makes small and very fast EXE'S, since the compiler is compiled in itself and not sitting on top of C/C++.


Glu
Post Reply