|
Post by Rod on Oct 8, 2019 15:59:14 GMT
Anatoly is right about the drawing stacking up. The loop takes longer than you have timed. Net result is that lots of drawing commands stack up. That's why Liberty takes so long to close, it is drawing all of the outstanding timed events.
It would crash if you left it running.
|
|
|
Post by tsh73 on Oct 8, 2019 17:49:45 GMT
Last post, with this text
- without glasses, 2 cubes. With glasses, single cube. 3d works for me.
|
|
|
Post by Rod on Oct 9, 2019 9:09:23 GMT
Will go and check again. Meanwhile look at this old QB code, 3d pop out in just a few lines. Has the makings of a 3d planetarium.
nomainwin open "3d Test" for graphics_fs_nsb as #w #w "trapclose [quit]" #w "down ; fill black ; size 2"
W=DisplayWidth-100 for n = 1 TO 25 X=rnd(0)*W + 20 D=rnd(0)*100 + 1 #w "color blue ; place ";X;" ";D*7;" ; circle ";D #w "color red ; place ";X+D;" ";D*7;" ; circle ";D next wait
[quit] close #w end
|
|
|
Post by Rod on Oct 9, 2019 11:01:17 GMT
And with a couple of coloured sprites we can animate a planet. Geometry isn't quite right but the 3d effect is there. nomainwin WindowWidth = DisplayWidth WindowHeight = DisplayHeight UpperLeftX = int((DisplayWidth-WindowWidth)/2) UpperLeftY = int((DisplayHeight-WindowHeight)/2) midx=int(WindowWidth/2) midy=int(WindowHeight/2) open "3d Test" for graphics_nsb as #w #w "trapclose [quit]" #w "down ; fill black ; size 2" W=DisplayWidth-100 for n = 1 TO 25 X=rnd(0)*W + 20 D=rnd(0)*100 + 1 #w "color blue ; place ";X;" ";D*7;" ; circle ";D #w "color red ; place ";X+D;" ";D*7;" ; circle ";D next #w "getbmp bak 0 0 ";WindowWidth;" ";WindowHeight #w "background bak" loadbmp "red","red.bmp" loadbmp "blue","blue.bmp" #w "addsprite blue blue" #w "addsprite red red"
n=1 timer 56, [draw] wait
[draw] x=midx-(200*sin(n/57.29577951)) y=midy-(100*cos(n/57.29577951)) d=int(midy-y)+100 #w "spritescale red ";d #w "spritexy red ";x;" ";y #w "spritescale blue ";d #w "spritexy blue ";x-d;" ";y #w "drawsprites" n=n+2 if n>=360 then n=0
wait
[quit] close #w end
|
|
|
Post by Rod on Oct 10, 2019 12:53:31 GMT
Two more sprite images to play with. Some simple code to animate. nomainwin WindowWidth = DisplayWidth WindowHeight = DisplayHeight UpperLeftX = int((DisplayWidth-WindowWidth)/2) UpperLeftY = int((DisplayHeight-WindowHeight)/2) midx=int(WindowWidth/2) midy=int(WindowHeight/2) open "3d Test" for graphics_nsb as #w #w "trapclose [quit]" #w "down ; fill black ; size 2"
#w "getbmp bak 0 0 ";WindowWidth;" ";WindowHeight #w "background bak" loadbmp "earth","earth.bmp" loadbmp "moon","moon.bmp" #w "addsprite earth earth" #w "addsprite moon moon" #w "spritescale earth 200" #w "spritexy earth ";midx-200;" ";midy-200
n=1 timer 56, [draw] wait
[draw] x=midx-(400*sin(n/57.29577951)) y=midy-(100*cos(n/57.29577951)) d=int(midy-y)+100 if d<50 then #w "spritetofront earth" else #w "spritetofront moon"
#w "spritescale moon ";d #w "spritexy moon ";x-d;" ";y #w "drawsprites" n=n+2 if n>=360 then n=0
wait
[quit] close #w end
|
|