Helix 3D Animation Screensaver

Share your advanced PureBasic knowledge/code with the community.
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

Reducing the the texture sizes wouldn't help to improve the CPU usage ad it depends on the videocard...

Adding a delay(1) inside the main loop should relax the CPU enough without ruining the smoothness.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Guimauve wrote:I have tested my code on my computer. So I have little bit reduced the number of model from 10 to 5. Also I have reduced the texture size from 128 pixels X 128 pixels to 64 pixels X 64 pixels.

This I will probably help your computer to render the scene.
Anyway if you have a small configuration PC will have many problems with this code.
Guimauve, i have no problems. It runs smoothly. But your code "eats" 100% CPU time in any PC
It is inadmissible that a screensaver get all 100% CPU use :!: :!:
Blade wrote:Reducing the the texture sizes wouldn't help to improve the CPU usage ad it depends on the videocard...
No. That's not the problem. The problem is explained here: viewtopic.php?t=12747
And here: viewtopic.php?t=12825 is a quick solution.
Blade wrote:Adding a delay(1) inside the main loop should relax the CPU enough without ruining the smoothness.
Yes. It depends on how fast is the machine. On fast machines Delay(15) instead Delay(1) works nice :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

Now I remember that thread... :D
My congrs Psychophanta, great solution.
Something like that should be included natively in PB (a flag in FlipBuffers() ?), so that anyone can easily make CPU free apps...[/u]
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Post by Guimauve »

:shock:

I can't understand why the Delay(10) can reduce CPU usage.

Anyways thanks for this small detail.

(Je retourne étudier ça)

Guimauve
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Code: Select all

; Index = SpinByte(Index,1,10,1)
?
at least works...
But I was expecting more.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Be carefull if you go higher than 1500.
I tried 2500 and things got really jerky.
At 2000 not half bad. At 1500 it was pretty ok.

Do NOT try 10000 models. I did and Windows went nuts with my swap file *laughs* Some insane memory needs.

Btw! 1500 models * 60 polygons = 90000 polygons.
so it seems that my system don't like more than 100000 polygons at least with this test.

A houndred thousand polygons is quite a lot though.
Most 3D characters in games are only 5000 polygons.
Which in this test would equal 84 or so models.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Post by Guimauve »

Just in case these command can be usefull to your project :

Code: Select all

ProcedureDLL.l SpinLong(No.l, mini.l, maxi.l, increment.l)
     
     No + increment
     
     If No > maxi
          No = mini
     EndIf
     
     If No < mini
          No = maxi
     EndIf
     
     ProcedureReturn No
     
EndProcedure


ProcedureDLL.f SpinFloat(No.f, mini.f, maxi.f, increment.f)
     
     No + increment
     
     If No > maxi
          No = mini
     EndIf
     
     If No < mini
          No = maxi
     EndIf
     
     ProcedureReturn No
     
EndProcedure

ProcedureDLL.b SpinByte(No.b, mini.b, maxi.b, increment.b)
     
     No + increment
     
     If No > maxi
          No = mini
     EndIf
     
     If No < mini
          No = maxi
     EndIf
     
     ProcedureReturn No
     
EndProcedure


ProcedureDLL.w SpinWord(No.w, mini.w, maxi.w, increment.w)
     
     No + increment
     
     If No > maxi
          No = mini
     EndIf
     
     If No < mini
          No = maxi
     EndIf
     
     ProcedureReturn No
     
EndProcedure
Sorry for any inconvenients.

Regards

Guimauve
Post Reply