NaaLaa
Draw pixel and alpha channel - Printable Version

+- NaaLaa (https://www.naalaa.com/forum)
+-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html)
+--- Forum: NaaLaa 7 Questions (https://www.naalaa.com/forum/forum-3.html)
+--- Thread: Draw pixel and alpha channel (/thread-70.html)

Pages: 1 2


RE: Draw pixel and alpha channel - Tomaaz - 02-09-2024

I replaced pixels with rectangles and it works like it should. It's a little bit slow, though. It looks the best with 60fps, but only compiled languages can achieve that on my computer.
Code:
set window "Bubble Universe", 512, 512
r = 6.283185307179586 / 235
mw = 512
mh = 512
hw = mw / 2
hh = mh / 2
x = 0
v = 0
u = 0
t = 0
k = rnd(190) + 64
set redraw 0
while 1
    set color 0, 0, 0, 255
    draw rect 0, 0, 512, 512, 1
    for i = 0 to 255
        for j= 0 to 255
            u = sin(i + v) + sin(r * i + x)
            v = cos(i + v) + cos(r * i + x)
            x = u + t
            set color i, j, 255 - i, k
            draw rect int(hw + u * hw * 0.4), int(hh + v * hh * 0.4), 1, 1
        next
    next
    redraw
    t = t + 0.01
    k = rnd(190) + 64
wend



RE: Draw pixel and alpha channel - Marcus - 02-09-2024

I'm far away from my home and computer, but it would be fun to see how it runs in n6.


RE: Draw pixel and alpha channel - Tomaaz - 02-09-2024

I tried, but a Linux version of N6 seems to be not working on my machine. I can't be bothered with installing the Windows version through Wine. Maybe someone who's got N6 and N7 installed on a Windows machine could check the difference in performance?


RE: Draw pixel and alpha channel - johnno56 - 02-09-2024

Well, with my eyesight, it still looks impressive! Yes, just a touch slower, but runs very well... Nicely done!