Author Topic: Lorenz Landscape  (Read 8404 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Lorenz Landscape
« on: April 12, 2014, 03:43:28 AM »
Deleted
« Last Edit: April 25, 2015, 03:05:41 AM by Peter »

Mike Lobanovsky

  • Guest
Re: Lorenz Landscape
« Reply #1 on: April 12, 2014, 11:35:07 AM »
Hello Peter,

Here come your results on my PC:
1. SDL
2. SimpleWindow
3. GDI+
It seems like the results should have been given in "seconds" rather than "msecs". :)

Using the exact same technique as in Trauma, FBSL's DIB Sections perform just a little slower than SDL. Perhaps its floating-point operations in C are a little less optimized than in SDL:

.

JRS

  • Guest
Re: Lorenz Landscape
« Reply #2 on: April 12, 2014, 12:17:08 PM »
Script BASIC GFX - Ubuntu 12.04 LTS 64 bit



Code: [Select]
' Lorenz Curtian

IMPORT gfx.inc

scrn = gfx::Window(600, 800, "ScriptBasic GFX - Lorenz Curtian")
ts = gfx::Time()
FOR t = 0 TO 7000 STEP 0.006
  x = SIN(0.99 * t) - 0.7 * COS(3.01 * t)
  y = COS(1.01 * t) + 0.1 * SIN(15.03 * t)
  x = x * 200 + 400
  y = y * 200 + 300
  gfx::pixelRGBA scrn, FIX(y), FIX(x), 250, 250, 250, 255
NEXT
te = gfx::Time()
gfx::stringColor scrn, 20, 20, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
gfx::Update
WHILE gfx::KeyName(1) <> "+escape"
WEND
gfx::Close
« Last Edit: April 12, 2014, 05:03:27 PM by John »

Mike Lobanovsky

  • Guest
Re: Lorenz Landscape
« Reply #3 on: April 12, 2014, 01:59:29 PM »
you could it convert for Fbsl,  if there is enough time.

Hehe, I'll see what I can do for you here, Peter. ;)

Charles Pegge

  • Guest
Re: Lorenz Landscape
« Reply #4 on: April 12, 2014, 03:41:47 PM »

I'm getting similar results to SDL, using Opengl directly. About 0.28 seconds to compile the glList.

But once the list is compiled, the Graphics processor takes 5 microseconds to execute, involving 1.5 microseconds of CPU time.

Code: [Select]
  includepath $\inc\
  % title     "Lorenz Plot"
  % width     600
  % height    800
  include     OpenglSceneFrame.inc

  sub initialize(sys hWnd)
  ========================
  'SetTimer hWnd,1,10,NULL
  end sub

  sub Release(sys hwnd)
  =====================
  DeleteAllGlCompiled
  'killTimer hwnd, 1
  end sub

  sub scene(sys hWnd)
  ===================
  '
  static single t,x,y        'Lorenz
  static quad t1,t2,t3,t4,t5 'Time Marks
  '
  StillFrame
  glClearColor  0.3, 0.0,  0.0, 0.0
  gltranslatef  0.00, 0.00, -1.00
  glScalef      0.22, 0.22,  0.22
  glColor3f .5, 1.0, 1.0 ' color 14
  glPointSize 1.0
  '
  BeginGlCompile Lorenz
  TimeMark t1
  glBegin GL_POINTS
  for t=0 to 7000.0 step 0.006
    x=sin(0.99*t)-0.7*cos(3.01*t)
    y=cos(1.01*t)+0.1*sin(15.03*t)
    glVertex2f y,x
  next
  glEnd
  TimeMark t2
  EndGlCompile
  '
  TimeMark t3
  go Lorenz
  TimeMark t4
  glFlush 'to get the GPU processing time
  TimeMark t5
  '
  SetWindowText hwnd, title +
  "   Compiling: " str(TimeDiff(t2,t1),3) +
  "   Plot: (CPU) "    str((TimeDiff t4,t3),3) +
  "   Plot: (GPU) "    str((TimeDiff t5,t3),3)
  '
  end sub

JRS

  • Guest
Re: Lorenz Landscape
« Reply #5 on: April 12, 2014, 03:58:56 PM »
Charles,

This is the error I'm getting trying to compile your code.

« Last Edit: April 12, 2014, 04:18:02 PM by John »

Charles Pegge

  • Guest
Re: Lorenz Landscape
« Reply #6 on: April 12, 2014, 04:23:53 PM »
Hi John,

Will be updating the library shortly.

Here are the timer functions to include:

Code: [Select]

  'MICROSECOND TIMER
  ==================
  '
  quad freq
  QueryPerformanceFrequency @freq
  '
  function TimeMark(quad*t)
  QueryPerformanceCounter @t
  end function
  '
  function TimeDiff(quad *te,*ts) as double
  return (te-ts)/freq 'SECONDS
  end function
  '
« Last Edit: April 12, 2014, 04:39:37 PM by Charles Pegge »

JRS

  • Guest
Re: Lorenz Landscape
« Reply #7 on: April 12, 2014, 04:42:35 PM »
I'm not getting any times. It compiled though.



.

Charles Pegge

  • Guest
Re: Lorenz Landscape
« Reply #8 on: April 12, 2014, 05:10:17 PM »
Interesting.

Because these functions are not part of the current OpenglSceneFrame Library, Frequency needs to be set in initialize(..)

Code: [Select]
'MICROSECOND TIMER
  ==================
  '
  quad freq
  '
  function TimeMark(quad*t)
  QueryPerformanceCounter @t
  end function
  '
  function TimeDiff(quad *te,*ts) as double
  return (te-ts)/freq 'SECONDS
  end function

  sub initialize(sys hWnd)
  ========================
  QueryPerformanceFrequency @freq
  'SetTimer hWnd,1,10,NULL
  end sub

...

JRS

  • Guest
Re: Lorenz Landscape
« Reply #9 on: April 12, 2014, 05:18:09 PM »
That solved it.



.

Mike Lobanovsky

  • Guest
Re: Lorenz Landscape
« Reply #10 on: April 13, 2014, 02:36:29 AM »
Gentlemen,

When Intel CPU SpeedStep is on (that is if your PC/laptop uses an iX series CPU), the method of calling QueryPerformanceFrequency() just once on program initialization won't work. You'll have to take this reading every time before you call QueryPerformanceCounter() otherwise your time-based animated movement will falter unless you switch this feature off in your BIOS/UEFI settings.

See how my CPU clock frequency (the top green line in my CPU Usage gadget) fluctuates as I'm writing this message. A similar technology of keeping extra activity of AMD CPU's down is called Cool n' Quiet.

.

Charles Pegge

  • Guest
Re: Lorenz Landscape
« Reply #11 on: April 13, 2014, 03:01:29 PM »

Thanks Mike, I'll make that alteration. taking the frequency, every time the time-diff calculation is done. This will work as long as the CPU does not lapse into quiescence during a time interval measurement.

Code: [Select]
  'MICROSECOND TIMER
  ==================
  '
  function TimeMark(quad*c)
  QueryPerformanceCounter @c
  end function
  '
  function TimeDiff(quad *te,*ts) as double
  QueryPerformanceFrequency @freq
  return (te-ts)/freq 'SECONDS
  end function

JRS

  • Guest
Re: Lorenz Landscape
« Reply #12 on: April 13, 2014, 04:00:50 PM »
Quote
This will work as long as the CPU does not lapse into quiescence during a time interval measurement.

Splitting the oxygen atom may be an easier task.   ;D

Aurel

  • Guest
Re: Lorenz Landscape
« Reply #13 on: April 14, 2014, 10:19:07 AM »
I can say that my little tiny-toy interpreter is a nasty ....
he don't like vertical than horizontal...why  ???
don't ask me  ;D ;D ;D

Code: [Select]
'lorenz2
wform 0,0,800,800,#MMS,0,"Lorenz Landscape"
defn t,x,y,a,b
'a = ticks
wColor 0,0,0
txcolor 0,150,180

For t,0,14000,1
    set x=sin(0.99*t)-0.7*cos(3.01*t)
    set y=cos(1.01*t)+0.1*sin(15.03*t)
    set x=x*200+400
    set y=y*200+400
    pix x,y
Next t

.

JRS

  • Guest
Re: Lorenz Landscape
« Reply #14 on: April 14, 2014, 10:44:12 AM »
Code: [Select]
pix x,y

Try this.

pix y,x