|
Post by bigbass on Nov 16, 2018 19:53:34 GMT 1
Hello Peter all is fine now for me too
I like xterm and have used it since my slackware days all these improvements and new features you are adding are really impressive !
if for some reason we hit a snag like the 32/64 bit problem or some other RPI related issue please don't take it as a negative we all look forward to your work
Joe
|
|
|
Post by Pjot on Nov 17, 2018 10:22:37 GMT 1
please don't take it as a negative On the contrary! The very fact that a lot of people are testing and are providing feedback makes BaCon better. So I highly appreciate you comments and I always take them seriously Best regards, Peter
|
|
|
Post by Pjot on Nov 18, 2018 12:16:41 GMT 1
PS on my 32bit VM there seems to be a rounding error, but I could not find the reason. Please let me know if you see weird drawing behavior.
After a long debug session I found the reason for this issue. On some platforms (for example, Mint 18.3 both 32/64bit) the actual drawing of a character in the "-*-*-bold-*-*-*-2-*-*-*-*-*-*-*" character set mysteriously leaves traces on the Xterm screen. This causes cluttering when animations are being drawn. I have changed the actual character to an XTerm embedded specific character (instead of ASCII), so animations now should show correctly on all platforms (latest here). BR Peter
|
|
|
Post by vovchik on Nov 18, 2018 14:39:29 GMT 1
Dear Peter, And here is Turtle Broccoli (not as nice as the tree). With kind regards, vovchik PRAGMA LDFLAGS -s INCLUDE canvas-xterm OPTION VARTYPE double
DECLARE canvas_w, canvas_h TYPE int canvas_w = 400 canvas_h = 400
' ------------------ SUB TREE(int depth, int length, double scale, double angle) ' ------------------ IF depth = 0 THEN EXIT SUB PEN(depth / 2.0, 1) DRAW(length) TURNRIGHT(angle) INK(145, 225, RANDOM(50), 200) TREE(depth-1, length * scale, scale, angle) TURNLEFT(2 *angle) INK(195, 255, RANDOM(50), 230) TREE(depth - 1, length * scale, scale, angle) TURNRIGHT(angle) DRAW(-length) ' Comment out next line if you want instant drawing/no animation ' IF EVEN(length) THEN SYNC END SUB
' create window WINDOW("Broccoli", canvas_w, canvas_h) INK(0, 0, 0, 255) CLS PENXY(200, 330) PEN(2.2, 1) INK(0, 255, 0, 190) TURNLEFT(90) ' Draw tree TREE(12, 80, 0.77, 30) ' Draw annotation INK(0, 255,0, 255) TEXT("Beautiful Turtle Broccoli", 5, 365) INK(0, 128,0, 255) TEXT("Beautiful Turtle Broccoli", 6, 366) WAITKEY
|
|
|
Post by Pjot on Nov 18, 2018 16:48:22 GMT 1
Thanks vovchik, Your program works as advertised! BR Peter Attachments:
|
|
|
Post by Pjot on Nov 19, 2018 21:25:46 GMT 1
Another small animation for the XTerm canvas, based on code from Tomaaz:
INCLUDE canvas-xterm
OPTION VARTYPE FLOATING
WINDOW("Mandelbrot Set", 240, 160)
xpos = 3 / 240 ypos = 2 / 160 magnification = 0.5 px = 14.17799995 py = 79.999904
SUB redraw
xpos = 3 / (240 * magnification) ypos = 2 / (160 * magnification) FOR x = 0 TO 240 x3 = x - 120 FOR y = 0 TO 160 y3 = y - 80 c = 0 a = 0 b = 0 z = 0 x2 = (xpos * (x3 + (px * magnification))) - 2 y2 = (ypos * (y3 + (py * magnification))) - 1 WHILE c < 255 AND z < 4 a2 = a * a - b * b b2 = 2 * a * b a = a2 + x2 b = b2 + y2 z = a * a + b * b c = c + 1 WEND IF c = 255 THEN c = 0 k = 0 l = 0 ELSE k = MOD(c, 50) * 5 l = 255 - c ENDIF INK(c, k, l, 255) PIXEL(x, y) NEXT NEXT
IF magnification < 1562550000000 THEN INCR magnification, magnification * 0.05 ELSE INK(0,0,0,255) TEXT("Done.", 10, 130) ENDIF
END SUB
CALLBACK(10, redraw) WAITKEY
|
|
|
Post by bigbass on Nov 24, 2018 18:06:51 GMT 1
Hello Peter
The code you posted partially works on the raspberrypi but something is wrong in the px py or the magnification or some buffer is overloaded?
if I edit the code here
IF magnification < 1562550000000 THEN INCR magnification, magnification * 0.05 ELSE INK(0,0,0,255) TEXT("Done.", 10, 130) ENDIF WAITKEY END SUB
redraw
CALLBACK(10, redraw)
WAITKEY It draws the image and waits correctly if I dont do that it draws very quickly then goes white and hangs
will provide any feedback needed or test ideas
I am using the latest beta
Joe
|
|
|
Post by Pjot on Nov 24, 2018 19:57:29 GMT 1
Hi Joe, The result should be as the below GIF version... So it is, in fact, an animation, and should not be waiting. Also, when I compile for 32bit, it works fine for me. However, please try the latest canvas-xterm version, because there have been some improvements which may help you. BR Peter
|
|
|
Post by bigbass on Nov 25, 2018 1:15:58 GMT 1
Hello Peter I like the gif and if that's what its supposed to do nice looking effects however I don't see where its going wrong sorry I did try many things before I posted with no luck and tried your latest canvas that you posted if you have another suggestion I would try it maybe vovchik had better results maybe the rpi just doesn't have enough computing power Joe
|
|
|
Post by vovchik on Nov 25, 2018 10:45:51 GMT 1
Dear Joe and Peter,
It works on pi but is very slow. I improved the performance a bit by changing the magnification:
INCLUDE canvas-xterm OPTION VARTYPE FLOATING
w = 240.0 h = 160.0 xpos = 3 / w ypos = 2 / h magnification = 0.5 px = 14.17799995 py = 79.999904
' ------------------ SUB REDRAW() ' ------------------ xpos = 3.0 / (w * magnification) ypos = 2.0 / (h * magnification) FOR x = 0 TO w x3 = x - 120 FOR y = 0 TO h y3 = y - 80 c = 0 a = 0 b = 0 z = 0 x2 = (xpos * (x3 + (px * magnification))) - 2 y2 = (ypos * (y3 + (py * magnification))) - 1 WHILE c < 255 AND z < 4 a2 = a * a - b * b b2 = 2 * a * b a = a2 + x2 b = b2 + y2 z = a * a + b * b c = c + 1 WEND IF c = 255 THEN c = 0 k = 0 l = 0 ELSE k = MOD(c, 50) * 5 l = 255 - c END IF INK(c, k, l, 255) PIXEL(x, y) NEXT y NEXT x IF magnification < 1562550000000 THEN 'INCR magnification, magnification * 0.05 INCR magnification, magnification * 0.1 ELSE INK(0, 0, 0, 255) TEXT("Done.", 10, h - 30) END IF END SUB
WINDOW("Mandelbrot Set", w, h) CALLBACK(10, REDRAW) WAITKEY
With kind regards, vovchik
|
|
|
Post by bigbass on Nov 25, 2018 19:31:23 GMT 1
Thank you Peter and vovchik
I see this as a time to do a pristine install of raspbian and run some new tests on a clean system
because even the altered version vovchik got to run very slowly just showed the image erased the image then went white screen then hangs there and nothing else happens
I am as of today running a fresh install but still setting up stuff because this also requires the latest beta from fossil
however Pushing XTerm to its limit has been reached on the rpi but we can still do wonderful stuff minus the heavy animation
Joe
|
|
|
Post by rikky on Nov 26, 2018 8:44:18 GMT 1
I use Berryboot for getting a new OS on the raspberry. berryterminal.com/doku.php/berrybootA fresh install goes very quickly and you can choose from different OSes. but what's more; Berryboot uses layers such as Puppy. Just wipe out your /media/pi/berryboot/data/... folder Caution though, for I found this out just not long ago, and I haven't dared to try this yet. I am waiting for the next time I run into trubbles. ---- Vovchick's program gives me only a white canvas with nothing on it on the pi. Rik.
|
|
|
Post by vovchik on Nov 26, 2018 10:33:13 GMT 1
Dear Rik,
I am using raspbian 8.0, and it works fine for me, apart from the slowness.
With kind regards, vovchik
|
|
|
Post by bigbass on Feb 6, 2019 17:16:17 GMT 1
Hello Peter I am happy to say I returned to this post and since then I have reinstalled another version of the raspberry pi os and all is fine and all your demos work correctly! sometimes we need to try again and post [SOLVED] all is working now P.S and vovchik's demo works correctly too now so in a nutshell when nothing seems to work correctly after a lot of debugging it may be time for a clean install and try again A great thing having an xterm canvas maybe later we could simulate some gcode images and find another way around the GL problem of the viewer when on the raspberry pi (the python canvas works though) using bCNC but I want another way with less dependencies for a simple test demo and am taking another look at this xterm canvas! maybe you are thinking what am I talking about here is a simple video of gcode in action we could convert the gcode to show the motion with an xterm canvas image simulating the cnc machine (that program uses GL and doesnt display with the raspberry pi) www.diymachining.com/g-code-example/Joe
|
|
|
Post by Pjot on Feb 6, 2019 18:42:26 GMT 1
Hi bigbass, I never heard of CNC before, but it sounds like an interesting idea BR Peter
|
|