Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 15:21 04 Dec 2022 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Bubble Universe Demo

     Page 2 of 2    
Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 459
Posted: 07:21pm 21 Nov 2022
Copy link to clipboard 
Print this post

  Goksteroo said  OOps... public video now

what is that running on please?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 07:38pm 21 Nov 2022
Copy link to clipboard 
Print this post

Best I can do incrementally 411mSec

' Bubble Universe
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer b,i,j,c(1764*2),d(1764*2),e(1764*2),f(1764*2)
Math set 3,e()
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
Backlight 95:CLS RGB(black)
t=Rnd*10
Timer =0
b=0
For i=50 To 255 Step 5
For j=50 To 255 Step 5
  f(b)=0
  Inc b
  f(b)=RGB(i,j,130)
  Inc b
Next j
Next i
Do
Print Timer
Timer =0
b=Peek(varaddr c())
Memory copy b+8,b,1764*2*8-8
b=Peek(varaddr d())
Memory copy b+8,b,1764*2*8-8
Inc t,0.025:b=1

For i=50 To 255 Step 5
  a=r*i
  For j=50 To 255 Step 5
    p=i+v:q=a+x
    u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
    x=u+t:c(b)=u*o+w:d(b)=v*o+h
    Inc b,2
  Next
Next
Box c(),d(),e(),e(),0,,f()
Loop
 
Bleep
Senior Member

Joined: 09/01/2022
Location: United Kingdom
Posts: 117
Posted: 08:00pm 21 Nov 2022
Copy link to clipboard 
Print this post

You got me thinking, bad thing, so.. how about this, using my original of doing the plotting in blocks of 41, but storing the result in a 2D array, then using the Math Split and Insert to move chunks around, into 1D arrays for plotting, smooth animation and 350mS refresh :-) So close to 3Hz update...
' Bubble Universe
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer g,b,i,j,c(41),d(41),e(41),n(41)
Dim Integer f(41,41),l(41,41),m(41,41)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
CLS RGB(black):Backlight 95
t=Rnd*10:Math set 3,e()

g=0
For i=50 To 255 Step 5
b=0
For j=50 To 255 Step 5
 m(g,b)=RGB(i,j,130):Inc b
Next
Inc g
Next
Do
Inc t,0.025:g=0:Timer =0
For i=50 To 255 Step 5
b=0
a=r*i
Math Slice f(),g,,c()
Math Slice l(),g,,d()
Box c(),d(),e(),e(),0,,0
For j=50 To 255 Step 5
 p=i+v:q=a+x
 u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
 x=u+t:c(b)=w+u*o:d(b)=h+v*o
 Inc b
Next
Math Slice m(),g,,n()
Box c(),d(),e(),e(),0,,n()
Math Insert f(),g,,c()
Math Insert l(),g,,d()
Inc g
Next i
Print Timer
Loop
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 1808
Posted: 09:22am 22 Nov 2022
Copy link to clipboard 
Print this post

Pico VGA version
' Bubble Universe
mode 2
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer g,b,i,j,c(41),d(41),e(41),n(41)
Dim Integer f(41,41),l(41,41),m(41,41)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
CLS RGB(black)':Backlight 95
t=Rnd*10:math set 2,e()'Math set 3,e()

For g=0 to 41
 for b=0 to 41
   m(g,b)=rgb(g*6,b*6,128*(g+b>30)*(g+b<60))
Next:Next

Do
Inc t,0.025:g=0:Timer =0
For i=50 To 255 Step 5
b=0
a=r*i
Math Slice f(),g,,c()
Math Slice l(),g,,d()
Box c(),d(),e(),e(),0,,0
For j=50 To 255 Step 5
p=i+v:q=a+x
u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
x=u+t:c(b)=w+u*o:d(b)=h+v*o
Inc b
Next
Math Slice m(),g,,n()
Box c(),d(),e(),e(),0,,n()
Math Insert f(),g,,c()
Math Insert l(),g,,d()
Inc g
Next i
'Print Timer
Loop

If nothing goes right ... turn left
 
Bleep
Senior Member

Joined: 09/01/2022
Location: United Kingdom
Posts: 117
Posted: 11:54am 22 Nov 2022
Copy link to clipboard 
Print this post

Hi Volhout,
Yes I like the way you've got the colours working with a limited set. :-)
You could of course, make use of the framebuffer on the VGA, which means you can get rid of all the array saving and copying, which only saves a surprisingly small amount of time, but it does mean you can increase the number of pixies to 2600, for approx the same refresh rate, I've reduced the pixi size as well, because I thought it looked a bit better, your choice, also if you want the faster update, or more points? just change the loop step back to 5 amazingly, there is almost no difference between drawing a small box 1x1 or 2x2 or even 10x10 rather than using the pixel command?
Regards, Kevin.

' Bubble Universe
MODE 2
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer g,b,i,j,c(51),d(51),e(51),n(51)
'Dim Integer f(51,51),l(51,51),m(51,51)
Dim Integer m(41,51)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
CLS RGB(black)':Backlight 95
t=Rnd*10:Math set 1,e()'Math set 3,e()
FRAMEBUFFER create
FRAMEBUFFER write f

For g=0 To 41
For b=0 To 51
  m(g,b)=RGB(g*6,b*5,128*(g+b>30)*(g+b<60))
  If g<26 And b<13 Then m(g,b)=RGB(0,128,0)
Next :Next

Do
CLS
Inc t,0.025:g=0:Timer =0
For i=50 To 255 Step 5
b=0:a=r*i
'Math Slice f(),g,,c()
'Math Slice l(),g,,d()
'Box c(),d(),e(),e(),0,,0
'Pixel c(),d(),0
For j=50 To 255 Step 4
p=i+v:q=a+x
u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
x=u+t:c(b)=w+u*o:d(b)=h+v*o
Inc b
Next
Math Slice m(),g,,n()
Box c(),d(),e(),e(),0,,n()
'Pixel c(),d(),n()
'Math Insert f(),g,,c()
'Math Insert l(),g,,d()
Inc g
Next i
FRAMEBUFFER copy f,n
Print Timer
Loop


PS. just noticed that a subset of the pixels were being coloured black, so I've forced them to be mid green.
Edited 2022-11-22 23:32 by Bleep
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 459
Posted: 05:33pm 27 Nov 2022
Copy link to clipboard 
Print this post

  Volhout said  Pico VGA version
' Bubble Universe
mode 2
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer g,b,i,j,c(41),d(41),e(41),n(41)
Dim Integer f(41,41),l(41,41),m(41,41)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
CLS RGB(black)':Backlight 95
t=Rnd*10:math set 2,e()'Math set 3,e()

For g=0 to 41
 for b=0 to 41
   m(g,b)=rgb(g*6,b*6,128*(g+b>30)*(g+b<60))
Next:Next

Do
Inc t,0.025:g=0:Timer =0
For i=50 To 255 Step 5
b=0
a=r*i
Math Slice f(),g,,c()
Math Slice l(),g,,d()
Box c(),d(),e(),e(),0,,0
For j=50 To 255 Step 5
p=i+v:q=a+x
u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
x=u+t:c(b)=w+u*o:d(b)=h+v*o
Inc b
Next
Math Slice m(),g,,n()
Box c(),d(),e(),e(),0,,n()
Math Insert f(),g,,c()
Math Insert l(),g,,d()
Inc g
Next i
'Print Timer
Loop


lcd but needed to remove mode 2
https://www.youtube.com/watch?v=kxrZFLxrB18
I prefered the first one https://www.youtube.com/watch?v=9hnGAgYMIv0
Edited 2022-11-28 03:37 by stanleyella
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2022