|
Post by bluatigro on Feb 24, 2019 15:13:29 GMT -5
hallo i m glad that carl posted a lb5 347 version i dont know if this was his intension
byref on array's is not working
dim i( 10 ) for x = 0 to 10 i( x ) = rnd(0) next x for h = 1 to 10 for l = 0 to h - 1 if i( h ) < i( l ) then call swap i( h ) , i( l ) end if next l next h for x = 0 to 10 print x , i( x ) next x end sub swap byref a , byref b h = a a = b b = h end sub
i can not [ jet ] enlarge the char's in the ide
the help file is missing
so i can not find out whats new in lb5
i m espesial interested in thge opengl example i can not find it
|
|
|
Post by Carl Gundel on Feb 24, 2019 15:33:18 GMT -5
Byref array value passing is not implemented. This is not a bug.
Setting the font and character size in the editor is not really a bug. I haven't implemented it yet.
The help is not missing because it hasn't been written yet.
What OpenGL example are you looking for?
|
|
|
Post by bluatigro on Feb 25, 2019 3:32:46 GMT -5
a colorful triangle thats rotating wil be good for me i wil build a bluaGL wrapper arount it
[ don that before ]
@ carl :
what is al new in lb5 ?
|
|
|
Post by bluatigro on Feb 25, 2019 3:47:06 GMT -5
inpresive : i do have to tink about a use for this :
'untitled.bas dim a( 2 ) dim b( 2 , 2 ) dim c( 2 , 2 , 2 ) dim d( 2 , 2 , 2 , 2 ) dim e( 2 , 2 , 2 , 2 , 2 ) dim f( 2 , 2 , 2 , 2 , 2 , 2 ) dim g( 2 , 2 , 2 , 2 , 2 , 2 , 2 ) dim h( 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 )
|
|
|
Post by bluatigro on Feb 25, 2019 4:07:01 GMT -5
this works :
print eval( "add( 1 , 2 )" ) end function add( a , b ) add = a + b end function
|
|
|
Post by donnybowers on Feb 25, 2019 6:00:42 GMT -5
inpresive : i do have to tink about a use for this : 'untitled.bas dim a( 2 ) dim b( 2 , 2 ) dim c( 2 , 2 , 2 ) dim d( 2 , 2 , 2 , 2 ) dim e( 2 , 2 , 2 , 2 , 2 ) dim f( 2 , 2 , 2 , 2 , 2 , 2 ) dim g( 2 , 2 , 2 , 2 , 2 , 2 , 2 ) dim h( 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 )
Can you really have a multidimensional array that goes that deep? What would you call that? A matrix?
|
|
|
Post by bluatigro on Feb 25, 2019 7:15:24 GMT -5
trying to use 3d array's [ matrix array ] and to test the speed of graphics i have no idea jet for the use of 7d array's
'' bluatigro 25 feb 2019 '' lino world global mmax , rotx , roty , rotz , trans , temp , number , angle , pi mmax = 20 rotx = mmax + 1 roty = maxx + 2 rotz = maxx + 3 trans = mmax + 4 temp = mmax + 5 pi = atn( 1 ) * 4 dim matrix( temp , 3 , 3 ) global xyz , xzy , yxz , yzx , zxy , zyx xyz = 0 xzy = 1 yxz = 2 yzx = 3 zxy = 4 zyx = 5 call matrix.init 0 open "lino3d 1.0" for graphics as #m #m "trapclose [quit]"
timer 40 , [tick] wait [tick] scan call link 1 , 0,0,0 , angle,0,0 , xyz , 0 call cube 0,0,0 , 50,50,50 , "black" , 5 angle = angle + 5 wait [quit] close #m end sub lino x1,y1,z1 , x2,y2,z2 , kl$ , size call spot x1,y1,z1 call spot x2,y2,z2 a1 = winx / 2 + x1 / ( z1 + 1000 ) * 1000 b1 = winx / 2 - y1 / ( z1 + 1000 ) * 1000 a2 = winx / 2 + x2 / ( z2 + 1000 ) * 1000 b2 = winx / 2 - y2 / ( z2 + 1000 ) * 1000 #m "color " ; kl$ #m "size " ; size #m "down" #m "line " ; a1 ; " " ; b1 ; " " ; a2 ; " " ; b2 #m "up" end sub sub cube x,y,z , dx,dy,dz , kl$ , size call lino x+dx,y+dy,z+dz,x-dx,y+dy,z+dz,kl$,size call lino x+dx,y+dy,z-dz,x-dx,y+dy,z-dz,kl$,size call lino x+dx,y-dy,z+dz,x-dx,y-dy,z+dz,kl$,size call lino x+dx,y-dy,z-dz,x-dx,y-dy,z-dz,kl$,size
call lino x+dx,y+dy,z+dz,x+dx,y-dy,z+dz,kl$,size call lino x+dx,y+dy,z-dz,x+dx,y-dy,z-dz,kl$,size call lino x-dx,y+dy,z+dz,x-dx,y-dy,z+dz,kl$,size call lino x-dx,y+dy,z-dz,x-dx,y-dy,z-dz,kl$,size
call lino x+dx,y+dy,z+dz,x+dx,y+dy,z-dz,kl$,size call lino x+dx,y-dy,z+dz,x+dx,y-dy,z-dz,kl$,size call lino x-dx,y+dy,z+dz,x-dx,y+dy,z-dz,kl$,size call lino x-dx,y-dy,z+dz,x-dx,y-dy,z-dz,kl$,size end sub sub link no , x , y , z , xz , yz , xy , ax , p if no < 1 or no > 20 then exit sub if p < 0 or p > 20 then exit sub if no = p then exit sub number = no call matrix.init rotx call matrix.init roty call matrix.init rotz call matrix.init trans matrix( rotx , 1 , 1 ) = cos( rad( yz ) ) matrix( rotx , 1 , 2 ) = sin( rad( yz ) ) matrix( rotx , 2 , 1 ) = 0-sin( rad( yz ) ) matrix( rotx , 2 , 2 ) = cos( rad( yz ) ) matrix( roty , 0 , 0 ) = cos( rad( xz ) ) matrix( roty , 0 , 2 ) = sin( rad( xz ) ) matrix( roty , 2 , 0 ) = 0-sin( rad( xz ) ) matrix( roty , 2 , 2 ) = cos( rad( xz ) ) matrix( rotz , 1 , 1 ) = cos( rad( xy ) ) matrix( rotz , 1 , 0 ) = sin( rad( xy ) ) matrix( rotz , 0 , 1 ) = 0-sin( rad( xy ) ) matrix( rotz , 0 , 0 ) = cos( rad( xy ) ) matrix( trans , 3 , 0 ) = x matrix( trans , 3 , 1 ) = y matrix( trans , 3 , 2 ) = z select case ax case xyz call matrix.reeks rotx , roty , rotz , trans , p , no case xzy call matrix.reeks rotx , rotz , roty , trans , p , no case yxz call matrix.reeks roty , rotx , rotz , trans , p , no case yzx call matrix.reeks roty , rotz , rotx , trans , p , no case zxy call matrix.reeks rotz , rotx , roty , trans , p , no case zyx call matrix.reeks rotz , roty , rotx , trans , p , no case else end select end sub function rad( deg ) rad = deg * pi / 180 end function sub spot byref x , byref y , byref z hx = matrix( number , 0 , 0 ) * x + matrix( number , 1 , 0 ) * y + matrix( number , 2 , 0 ) * z + matrix( number , 3 , 0 ) hy = matrix( number , 0 , 1 ) * x + matrix( number , 1 , 1 ) * y + matrix( number , 2 , 1 ) * z + matrix( number , 3 , 1 ) hz = matrix( number , 0 , 2 ) * x + matrix( number , 1 , 2 ) * y + matrix( number , 2 , 2 ) * z + matrix( number , 3 , 2 ) x = hx y = hy z = hz end sub sub matrix.reeks a , b , c , t , p , uit call matrix.multiply a , b , temp call matrix.multiply temp , c , a call matrix.multiply a , t , temp call matrix.multiply temp , p , uit end sub sub matrix.multiply a , b , uit for i = 0 to 3 for j = 0 to 3 matrix( uit , i , j ) = 0 for k = 0 to 3 matrix( uit , i , j ) = matrix( uit , i , j ) + matrix( a , i , k ) * matrix( b , k , j ) next k next j next i end sub sub matrix.init no for i = 0 to 3 for j = 0 to 3 matrix( no , i , j ) = 0 next j matrix( no , i , i ) = 1 next i end sub
WARNING : this froze my pc
|
|
|
Post by Carl Gundel on Feb 25, 2019 7:44:19 GMT -5
Your PC froze, or Liberty BASIC froze? I just tried your example and definitely saw a crash and error but I was able to continue and then I used Kill BASIC Programs and was fine after that.
|
|
|
Post by bluatigro on Feb 25, 2019 9:56:05 GMT -5
@ carl : liberty froze
i get no line anywere
|
|
|
Post by Gordon Rahman on Feb 25, 2019 10:00:13 GMT -5
@ carl : liberty froze i get no line anywere @ bluatigro: Maybe the byref in your Call ? Gordon
|
|
|
Post by Rod on Feb 25, 2019 11:28:14 GMT -5
The code posted chokes on the "call link" line because angle is defined as global and you choose to pass it as a parameter. Remove the angle parameter and the code draws to the screen. Though probably still has bugs.
Passing global parameters has been debated before. Personally I don't think you should be allowed to include a global parameter in a call statement.
|
|
|
Post by bluatigro on Feb 26, 2019 4:45:42 GMT -5
@ rod : i can not do some things as global's can not be used parameters globall's can be var's or const's
i try to solve the angle problem :
'' bluatigro 25 feb 2019 '' lino world WindowWidth = DisplayWidth WindowHeight = DispayHeight global winx , winy winx = WindowWidth winy = WindowHeight global mmax , rotx , roty , rotz , trans , temp , number , angle , pi mmax = 20 rotx = mmax + 1 roty = maxx + 2 rotz = maxx + 3 trans = mmax + 4 temp = mmax + 5 pi = atn( 1 ) * 4 dim matrix( temp , 3 , 3 ) global xyz , xzy , yxz , yzx , zxy , zyx xyz = 0 xzy = 1 yxz = 2 yzx = 3 zxy = 4 zyx = 5 call matrix.init 0 open "lino3d 1.0" for graphics as #m #m "trapclose [quit]" timer 40 , [tick] wait [tick] scan #m "fill black" a = angle call link 1 , -200,100,0 , a,a,a , xyz , 0 call cube 0,0,0 , 50,50,50 , "red" , 5 call link 1 , 0,100,0 , a,a,a , yzx , 0 call cube 0,0,0 , 50,50,50 , "green" , 5 call link 1 , 200,100,0 , a,a,a , zxy , 0 call cube 0,0,0 , 50,50,50 , "blue" , 5 call link 1 , -200,-100,0 , a,a,a , zyx , 0 call cube 0,0,0 , 50,50,50 , "cyan" , 5 call link 1 , 0,-100,0 , a,a,a , xzy , 0 call cube 0,0,0 , 50,50,50 , "pink" , 5 call link 1 , 200,-100,0 , a,a,a , yxz , 0 call cube 0,0,0 , 50,50,50 , "yellow" , 5 angle = angle + 5 wait [quit] close #m end sub lino x1,y1,z1 , x2,y2,z2 , kl$ , size call spot x1,y1,z1 call spot x2,y2,z2 a1 = winx / 2 + x1 / ( z1 + 1000 ) * 1000 b1 = winx / 2 - y1 / ( z1 + 1000 ) * 1000 a2 = winx / 2 + x2 / ( z2 + 1000 ) * 1000 b2 = winx / 2 - y2 / ( z2 + 1000 ) * 1000 #m "color " ; kl$ #m "size " ; size #m "down" #m "line " ; a1 ; " " ; b1 ; " " ; a2 ; " " ; b2 #m "up" end sub sub cube x,y,z , dx,dy,dz , kl$ , size call lino x+dx,y+dy,z+dz,x-dx,y+dy,z+dz,kl$,size call lino x+dx,y+dy,z-dz,x-dx,y+dy,z-dz,kl$,size call lino x+dx,y-dy,z+dz,x-dx,y-dy,z+dz,kl$,size call lino x+dx,y-dy,z-dz,x-dx,y-dy,z-dz,kl$,size
call lino x+dx,y+dy,z+dz,x+dx,y-dy,z+dz,kl$,size call lino x+dx,y+dy,z-dz,x+dx,y-dy,z-dz,kl$,size call lino x-dx,y+dy,z+dz,x-dx,y-dy,z+dz,kl$,size call lino x-dx,y+dy,z-dz,x-dx,y-dy,z-dz,kl$,size
call lino x+dx,y+dy,z+dz,x+dx,y+dy,z-dz,kl$,size call lino x+dx,y-dy,z+dz,x+dx,y-dy,z-dz,kl$,size call lino x-dx,y+dy,z+dz,x-dx,y+dy,z-dz,kl$,size call lino x-dx,y-dy,z+dz,x-dx,y-dy,z-dz,kl$,size end sub sub link no , x , y , z , xz , yz , xy , ax , p if no < 1 or no > 20 then exit sub if p < 0 or p > 20 then exit sub if no = p then exit sub number = no call matrix.init rotx call matrix.init roty call matrix.init rotz call matrix.init trans matrix( rotx , 1 , 1 ) = cos( rad( yz ) ) matrix( rotx , 1 , 2 ) = sin( rad( yz ) ) matrix( rotx , 2 , 1 ) = 0-sin( rad( yz ) ) matrix( rotx , 2 , 2 ) = cos( rad( yz ) ) matrix( roty , 0 , 0 ) = cos( rad( xz ) ) matrix( roty , 0 , 2 ) = sin( rad( xz ) ) matrix( roty , 2 , 0 ) = 0-sin( rad( xz ) ) matrix( roty , 2 , 2 ) = cos( rad( xz ) ) matrix( rotz , 1 , 1 ) = cos( rad( xy ) ) matrix( rotz , 1 , 0 ) = sin( rad( xy ) ) matrix( rotz , 0 , 1 ) = 0-sin( rad( xy ) ) matrix( rotz , 0 , 0 ) = cos( rad( xy ) ) matrix( trans , 3 , 0 ) = x matrix( trans , 3 , 1 ) = y matrix( trans , 3 , 2 ) = z select case ax case xyz call matrix.reeks rotx , roty , rotz , trans , p , no case xzy call matrix.reeks rotx , rotz , roty , trans , p , no case yxz call matrix.reeks roty , rotx , rotz , trans , p , no case yzx call matrix.reeks roty , rotz , rotx , trans , p , no case zxy call matrix.reeks rotz , rotx , roty , trans , p , no case zyx call matrix.reeks rotz , roty , rotx , trans , p , no case else end select end sub function rad( deg ) rad = deg * pi / 180 end function sub spot byref x , byref y , byref z hx = matrix( number , 0 , 0 ) * x + matrix( number , 1 , 0 ) * y + matrix( number , 2 , 0 ) * z + matrix( number , 3 , 0 ) hy = matrix( number , 0 , 1 ) * x + matrix( number , 1 , 1 ) * y + matrix( number , 2 , 1 ) * z + matrix( number , 3 , 1 ) hz = matrix( number , 0 , 2 ) * x + matrix( number , 1 , 2 ) * y + matrix( number , 2 , 2 ) * z + matrix( number , 3 , 2 ) x = hx y = hy z = hz end sub sub matrix.reeks a , b , c , t , p , uit call matrix.multiply a , b , temp call matrix.multiply temp , c , a call matrix.multiply a , t , temp call matrix.multiply temp , p , uit end sub sub matrix.multiply a , b , uit for i = 0 to 3 for j = 0 to 3 matrix( uit , i , j ) = 0 for k = 0 to 3 matrix( uit , i , j ) = matrix( uit , i , j ) + matrix( a , i , k ) * matrix( b , k , j ) next k next j next i end sub sub matrix.init no for i = 0 to 3 for j = 0 to 3 matrix( no , i , j ) = 0 next j matrix( no , i , i ) = 1 next i end sub
this is not tested the pc of the DAC gives that there is a error in vcruntime140.dll
|
|
|
Post by bluatigro on Feb 26, 2019 7:36:28 GMT -5
STRANGE : the window do not react to X close programe whit icon on taskbar
eroor : the cube's are not drawn
|
|
|
Post by Rod on Feb 26, 2019 11:11:21 GMT -5
You are still passing a global in the parameter list, xyz
That is what is stopping the code on LB5 for me.
Why do you need to pass globals when they are visible to the entire system? Byref and Constants are different concepts.
|
|
|
Post by bluatigro on Feb 27, 2019 4:33:41 GMT -5
@ rod : i need golbal's as parameters becouse a xyz is easyer to remember then 0 next i wil build a avartar how keep i that readeble if i can not use global names for lim's ?
sometimes it is nesesery to use global's as parameters
can anyone build a avatar whitout global lim number's ?
|
|