Retrogamecoding(.org) > Pulsar2D

Pulsar2D is still alive ...

<< < (3/8) > >>

Rick3137:
    I made a short program to draw a hexagon.
    I did a sync(), to show it. Worked fine.
    I then did a drawtext command and did another sync() to show that.
    The 2nd sync() eraised the hexagon.
    Is that normal?

--- Code: ---   

win = openwindow ("Hexagon",-1,-1,640,480)
setactivewindow (win)

textsize(2)
backcolor (0,0,0,255)

cls()   
Pi2=6.28318
 Ang1 = Pi2/6 ; Ang = 0 ; x = 400.0 ; y = 400.0
 color (255,0,0,255)


 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > Pi2 then
      Ang = Ang - Pi2
  end
 end
  function MoveSteps ( distance )

        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy

        line( x,y,x2,y2)
        x = x2 ; y = y2
       
   end   


color (0,0,255,255)       
         cnt = 0
          while cnt < 6
          do                 -- the pair of keywords " do " and " end " are like brackets in c-language
             MoveSteps ( 100 )
             RotateLeft()
             cnt = cnt + 1
          end
--sync()
drawtext("Press any key to exit ..",0,0)
sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()






--- End code ---

Bereb:

--- Quote from: Cybermonkey on October 13, 2015, 04:41:31 PM ---
--- Quote from: Bereb on October 13, 2015, 03:01:44 PM ---There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).

--- End quote ---

For refreshing the window you need always to do a sync().

--- End quote ---

Yes, I did it: redraw() or sync(). I must express wrong (sorry for my english!)  :-[
I meant the Pulsar window does not display its content again after its status has been modified, e.g. by resizing (minimizing)  the window or when it has been hidden by another window.



--- Quote from: Cybermonkey on October 13, 2015, 04:41:52 PM ---
--- Quote from: Bereb on October 13, 2015, 04:09:25 PM ---Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)

--- End quote ---
Do you have an example?

EDIT: I just tested the fractals.lua; see for yourself. Pulsar2D is faster (the mentioned 0.3 seconds). Do you use a hardware accelerated graphics driver?

--- End quote ---

 :-\ Sorry again, I didn't specify the scripts I used. But it was precisely this same example, and another too.
I don't think I have a hardware accelerated graphics driver in my old computer (and I don't know how I can detect it).
However, with the last release of Löve, for instance, I noticed a real improvement (speed, etc.), in relation to its previous versions − moreover I'm not very comfortable with the “programming style” of Löve.

On the other hand, I must say that animations are at least twice faster (maybe more) with Pulsar than with EGSL. My reckonings are not accurate ; I just modified all my temporizings on the run, multiplying them (or reducing the steps) by two.

Cybermonkey:

--- Quote from: Rick3137 on October 13, 2015, 10:34:05 PM ---    I made a short program to draw a hexagon.
    I did a sync(), to show it. Worked fine.
    I then did a drawtext command and did another sync() to show that.
    The 2nd sync() eraised the hexagon.
    Is that normal?

--- Code: ---   

win = openwindow ("Hexagon",-1,-1,640,480)
setactivewindow (win)

textsize(2)
backcolor (0,0,0,255)

cls()   
Pi2=6.28318
 Ang1 = Pi2/6 ; Ang = 0 ; x = 400.0 ; y = 400.0
 color (255,0,0,255)


 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > Pi2 then
      Ang = Ang - Pi2
  end
 end
  function MoveSteps ( distance )

        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy

        line( x,y,x2,y2)
        x = x2 ; y = y2
       
   end   


color (0,0,255,255)       
         cnt = 0
          while cnt < 6
          do                 -- the pair of keywords " do " and " end " are like brackets in c-language
             MoveSteps ( 100 )
             RotateLeft()
             cnt = cnt + 1
          end
--sync()
drawtext("Press any key to exit ..",0,0)
sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()

--- End code ---

--- End quote ---
Nope, that's not normal. I tried your example with one and two syncs and it works nice here. Meaning with two syncs nothing is erased ...

Cybermonkey:

--- Quote from: Bereb on October 14, 2015, 09:11:52 AM ---
--- Quote from: Cybermonkey on October 13, 2015, 04:41:31 PM ---
--- Quote from: Bereb on October 13, 2015, 03:01:44 PM ---There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).

--- End quote ---

For refreshing the window you need always to do a sync().

--- End quote ---

Yes, I did it: redraw() or sync(). I must express wrong (sorry for my english!)  :-[
I meant the Pulsar window does not display its content again after its status has been modified, e.g. by resizing (minimizing)  the window or when it has been hidden by another window.



--- Quote from: Cybermonkey on October 13, 2015, 04:41:52 PM ---
--- Quote from: Bereb on October 13, 2015, 04:09:25 PM ---Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)

--- End quote ---
Do you have an example?

EDIT: I just tested the fractals.lua; see for yourself. Pulsar2D is faster (the mentioned 0.3 seconds). Do you use a hardware accelerated graphics driver?

--- End quote ---

 :-\ Sorry again, I didn't specify the scripts I used. But it was precisely this same example, and another too.
I don't think I have a hardware accelerated graphics driver in my old computer (and I don't know how I can detect it).
However, with the last release of Löve, for instance, I noticed a real improvement (speed, etc.), in relation to its previous versions − moreover I'm not very comfortable with the “programming style” of Löve.

On the other hand, I must say that animations are at least twice faster (maybe more) with Pulsar than with EGSL. My reckonings are not accurate ; I just modified all my temporizings on the run, multiplying them (or reducing the steps) by two.

--- End quote ---

Animations are using now a "real" timer, in EGSL it was just a counter...
Anyway, it shouldn't be possible to resize the windows with your mouse, at least it isn't possible on my systems (Linux Mint, Xubuntu, Windows 7 and Windows 10).
It can be if the window isn't refreshed anymore and waiting for a keypress or such that the content isn't visible anymore. This shouldn't happen using a game loop where the content is refreshed a few times per second. Is it possible for you to make a screencast video?

Bereb:

--- Quote from: Cybermonkey on October 14, 2015, 03:31:01 PM ---Anyway, it shouldn't be possible to resize the windows with your mouse, at least it isn't possible on my systems (Linux Mint, Xubuntu, Windows 7 and Windows 10).
--- End quote ---
I am on Lubuntu 14.04, and it is possible to reduce (minimize in the application bar)  a Pulsar window or to hide it with another one  during an animation. And of course, the Pulsar window does refresh itself thanks to the animation loop.


--- Quote from: Cybermonkey ---It can be if the window isn't refreshed anymore and waiting for a keypress or such that the content isn't visible anymore.
--- End quote ---
Indeed, but in this case, with EGSL we could recover the window and its content nevertheless, with no need to run the script again.



Concerning the script which runs faster on EGSL than on Pulsar, here is my script (with the results at the end).
It may be that I was mistaken somewhere :

--- Code: ---local bx,by,bw,bh
bx=0
by=0
bw=256*2
bh=256*2

local sx,sy,sw,sh
sx=-2.2
sy=-1.7
sw=3.4
sh=3.4

local clock = os.clock
local temps, t0, t1
local gx, gy, zx, zy, nzx
local col,r,v,b
local x, y, c

local fen = openwindow("Mandel simple (Pulsar2D)", 50, 50, bw,bh)
setactivewindow(fen)
backcolor(0,0,0,255)
clearwindow()
sync()

t0=clock()

for x=0,bw do
for y=0,bh do
gx=x/bw*sw+sx
gy=y/bh*sh+sy
zx=gx
zy=gy
for c=0,255 do
col = c
nzx=zx*zx - zy*zy + gx
zy=2*zx*zy+gy
zx=nzx
if zx*zx + zy*zy > 4 then
col = c
break
end 
end
r = col     
v = col*32 
b = col*64 
color(r,v,b,255)
dot(x,y)
end
end

t1=clock()
temps = (t1-t0)
text = tostring(temps).." secondes."

color(255,255,0,255)
drawtext(text, 2, 2)
sync()

inkey()
closewindow(fen)
closeapplication()

-- EGSL   : 2.978096 sec.
-- Pulsar : 3.359697 sec.
-- diff.  = 0.381601 sec.
--- End code ---


Other information : the problem reported by Rick3137 does not happen on my computer...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version