It is currently Sat May 18, 2013 1:43 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Simple Windowed OpenGL Framework - for OpenGL beginners
PostPosted: Fri Sep 21, 2007 2:38 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2238
Location: Italy
[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 !



Download (fixed for PB 5.10) --> swof.zip

Have fun.

EDIT: It's WAAAY outdated but I fixed it for PB 5.10, since it was no more compilable.


Last edited by luis on Tue Feb 12, 2013 1:45 pm, edited 18 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 2:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 02, 2007 1:43 am
Posts: 627
Location: Brazil
Nice, very nice.
This should get me started.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 3:05 pm 
Wowzers, thank you very much for sharing this.


Top
  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 5:11 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Cracking! :)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 23, 2007 12:36 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2238
Location: Italy
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 25, 2007 11:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Feb 16, 2006 1:41 am
Posts: 167
Location: New Zealand
Very nice, thanks for sharing your work!!

Hope there's more to come.

_________________
WinXP Pro-SP3, PB4, slow CPU, ancient video card, fuzzy monitor
"When the facts change, I change my mind" - John Maynard Keynes


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 8:23 pm 
Offline
PureBasic Fanatic
PureBasic Fanatic
User avatar

Joined: Fri Dec 09, 2005 12:15 pm
Posts: 2186
Location: RO, the land of all possibilities
[Removed]

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

_________________
I hear and I forget. I see and I remember. I do and I understand. (Confucius)

Image


Last edited by Inf0Byt3 on Mon Oct 08, 2007 12:35 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 06, 2007 2:37 pm 
Offline
User
User

Joined: Fri Oct 05, 2007 8:10 pm
Posts: 10
nice :D


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 06, 2007 3:05 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Jul 02, 2004 6:49 pm
Posts: 833
Location: Australia
Nice? This is some really good stuff! :D

_________________
Microgateways


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 06, 2007 3:13 pm 
Offline
PureBasic Fanatic
PureBasic Fanatic
User avatar

Joined: Fri Dec 09, 2005 12:15 pm
Posts: 2186
Location: RO, the land of all possibilities
Yup, it should get anybody started within minutes :).

_________________
I hear and I forget. I see and I remember. I do and I understand. (Confucius)

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 07, 2007 8:51 am 
Offline
Enthusiast
Enthusiast

Joined: Mon May 14, 2007 2:13 am
Posts: 731
Location: Darling River
Great work, this helps with my learning a lot.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 14, 2007 4:14 pm 
Offline
User
User

Joined: Sat Aug 04, 2007 1:05 pm
Posts: 19
Location: Germany
Great work.....
For me absolutly great stuff for trying to do OPENGL
Go on, i like yur Demo
Thanks

Cheers
eNeRGy


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 14, 2007 6:18 pm 
Offline
User
User
User avatar

Joined: Sat Apr 26, 2003 4:37 am
Posts: 70
Location: US
Very nice! Thx for sharing your work! 8)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 7:45 am 
Offline
Enthusiast
Enthusiast

Joined: Fri May 21, 2004 3:31 pm
Posts: 151
wow,
Impressionante! :shock:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 10:36 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2238
Location: Italy
Updated for 4.30 (beta). :wink:


Last edited by luis on Wed Dec 17, 2008 10:24 pm, edited 2 times in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye