Page 1 of 3

Simple Windowed OpenGL Framework - for OpenGL beginners

Posted: Fri Sep 21, 2007 2:38 pm
by luis
[Win32, PureBasic 4.02-4.30, OpenGL]

I wrote this simple framework in PB to make experiments while learning OpenGL, maybe some other people starting right now can found it useful to learn how to use OpenGL with PB.

So, what can you learn from this ? (or if you prefer, what did I learn doing this ?)

* how to setup a windowed OpenGL framework
* how to check for errors after calling an OpenGL function
* how to render a scene while switching resolution on the fly
* how to do simple multithreading and event synchronization
* how to check for OpenGL extensions and use them
* how to execute a demo at the same speed with VSync enabled at 60 Hz (60 FPS) and with VSync disabled drawing at 250 FPS (for example)
* how to count the number of FPS your application is rendering
* how to separate every demo from the framework code, coding it in a dedicated include file
* how to enable multisample to do full scene antialiasing
* how to render some nice text in 3d (not using fixed bitmaps)
* how to grab a texture from memory and apply it to a polygon
* how to do some simple blending effects
* how to use display lists to speed up your rendering
* how to implement basic fog effect
* how to add a light to a scene and specify color tracking for materials
* how to load an RGB image, transform it to RGBA (add an alpha channel) and use it to do blending effects (sprites, etc.)
* how to switch back and forth from #GL_PROJECTION to #GL_MODELVIEW and how to use them both on the same scene, pushing and popping them from the stack


Image



NOTE: this program still use a lot of .l variable declaration, now it works with 4.30 but when coding a new program now you should use .i or avoid the type declaration for integers.

See this article about portability by Freak: http://www.purebasic.fr/blog/?p=42

For the rest, it still can be useful to any Opengl+PB beginner, even if in the meantime I learned a lot more and probably I would rewrite this differently. Maybe I'll do !



EDIT: now SGL is available -> viewtopic.php?t=81764

Posted: Fri Sep 21, 2007 2:40 pm
by byo
Nice, very nice.
This should get me started.
Thanks.

Posted: Fri Sep 21, 2007 3:05 pm
by Brice Manuel
Wowzers, thank you very much for sharing this.

Posted: Fri Sep 21, 2007 5:11 pm
by srod
Cracking! :)

Posted: Sun Sep 23, 2007 12:36 am
by luis
You are all welcome, I'm still adding "demos" to that, but right now I'm doing something else and I thought I could post what I done at the moment.

Cheers :)

Posted: Tue Sep 25, 2007 11:59 pm
by Amundo
Very nice, thanks for sharing your work!!

Hope there's more to come.

Posted: Fri Oct 05, 2007 8:23 pm
by Inf0Byt3
[Removed]

Luis has uploaded it and edited the links. See the first post.

Posted: Sat Oct 06, 2007 2:37 pm
by Xqerience2003
nice :D

Posted: Sat Oct 06, 2007 3:05 pm
by Baldrick
Nice? This is some really good stuff! :D

Posted: Sat Oct 06, 2007 3:13 pm
by Inf0Byt3
Yup, it should get anybody started within minutes :).

Posted: Sun Oct 07, 2007 8:51 am
by electrochrisso
Great work, this helps with my learning a lot.
Thanks.

Posted: Sun Oct 14, 2007 4:14 pm
by energy
Great work.....
For me absolutly great stuff for trying to do OPENGL
Go on, i like yur Demo
Thanks

Cheers
eNeRGy

Posted: Sun Oct 14, 2007 6:18 pm
by BasicGuy
Very nice! Thx for sharing your work! 8)

Posted: Mon Oct 15, 2007 7:45 am
by jpd
wow,
Impressionante! :shock:

Posted: Sun Sep 28, 2008 10:36 pm
by luis
Updated for 4.30 (beta). :wink: