Small FMOD-Visualizer (little OpenGL + source)

Share your advanced PureBasic knowledge/code with the community.
Tomcat
User
User
Posts: 15
Joined: Sat Apr 26, 2003 6:59 am
Location: Germany

Small FMOD-Visualizer (little OpenGL + source)

Post by Tomcat »

Hello all together,

I've coded some time ago a small visualizer for FMOD in C++ and I've thought about converting this little demo to PB, since it uses a little bit OpenGL and it just needs pure CPU-power (which is easily done by PB :-)

Click here for a screenshot ~159kb

Click here for download (with sources) ~176kb

I've also included the sourcecode (hopefully, I've commented it good enough for you :-), so you can have an idea of how I've done it. If some of you like, I could also convert my "dancing fire" from my C++ version. Have fun!

Bye,
Tomek
Last edited by Tomcat on Fri Feb 03, 2006 9:59 am, edited 1 time in total.
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

@Tomcat:

That looks fantastic :!: Thanks for sharing the source ... will have a look into
it later on - very good job :!:
regards,
benny!
-
pe0ple ar3 str4nge!!!
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

wow !! what a very nice effect !
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Very good ! About the WindowEvent() handling, you have to process all the events at each frame or some event will lag (try resizing the window):

It can look like this:

Code: Select all

  Repeat
    Select WindowEvent()
      Case #PB_Event_Menu
        [...]
      Case 0
        Break
    EndSelect
  ForEver
Then the resize works as expected :).
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Tomcat, this is extremely usefull. Thanx for sharing. I am amazed again :wink:
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Nice effect and thanks for the source!
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Ditto the other comments, thanks!
Intrigued - Registered PureBasic, lifetime updates user
Tomcat
User
User
Posts: 15
Joined: Sat Apr 26, 2003 6:59 am
Location: Germany

Post by Tomcat »

Hi guys,

thanks again for your positive feedback :-) I've made some small modifications on the source (little speed-ups) and enabled the window to accept files (just drag & drop your file into the window).

@Fred: I've tried like you said, but then it just quits. Well, as long as it lag just a little bit, I can bear it :-)

Bye,
Tomek
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

@Tomcat:

Just one little thing. Your app is rather cpu-consuming (~98%). Maybe you
add a little Delay() function or try to run it at a constant framerate.
regards,
benny!
-
pe0ple ar3 str4nge!!!
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Yeah, I thought that too. Usually just "delay(1)" works fine. Or turn vsync on?
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post by Baldrick »

Excellent stuff Tomcat!!

Big thanks for sharing
Tomcat
User
User
Posts: 15
Joined: Sat Apr 26, 2003 6:59 am
Location: Germany

Post by Tomcat »

Hi benny and dmoc,

thanks for your suggestion, I've now added a small delay.

I've also added a second effect (a "dancing fire" :-) and already uploaded the new version (same link as before, screenshot is also updated).

Bye,
Tomek
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

@tomcat:

2nd fx is cool as well and work perfectly here, too :!:
Also the cpu-usage is now at a moderate state ... well done :!:
regards,
benny!
-
pe0ple ar3 str4nge!!!
Post Reply