OPEN GL
Post by bluatigro on Jan 28th, 2015, 09:01am
i font on internet this Code:
nomainwin
struct PFD, Size as word, Version as word, Flags as long,_
PixelType as char[1], ColorBits as char[1], RedBits as char[1],_
RedShift as char[1], GreenBits as char[1], GreenShift as char[1],_
BlueBits as char[1], BlueShift as char[1], AlphaBits as char[1],_
AlphaShift as char[1],AccumBits as char[1], AccumRedBits as char[1],_
AccumGreenBits as char[1], AccumBlueBits as char[1], AccumAlphaBits as char[1],_
DepthBits as char[1], StencilBits as char[1], AuxBuffers as char[1],_
LayerType as char[1], Reserved as char[1], LayerMask as long,_
VisibleMask as long, DamageMask as long
PFD.Version.struct=1
PFD.ColorBits.struct=24
PFD.DepthBits.struct=16
PFD.Size.struct=len(PFD.struct)
PFD.Flags.struct=37
GlColorBufferBit=16384
open "opengl32.dll" for dll as #gl
WindowWidth=500
WindowHeight=500
UpperLeftX=1
UpperLeftY=1
graphicbox #main.gr, 1, 1, 480, 480
open "Triangle" for window as #main
print #main,"trapclose [quit]"
MainH=hwnd(#main.gr)
#main.gr, "down"
calldll #user32,"GetDC", MainH as ulong, MainDC as ulong
calldll #gdi32,"ChoosePixelFormat", MainDC as ulong, PFD as struct, ret as long
calldll #gdi32, "SetPixelFormat", MainDC as ulong, ret as long, PFD as struct, t as long
calldll #gl,"wglCreateContext", MainDC as ulong, GLContext as ulong
calldll #gl,"wglMakeCurrent", MainDC as ulong, GLContext as ulong, ret as long
calldll #gl,"glClear", GlColorBufferBit as long, ret as long
calldll #gl,"glRotated", 0 as double, 0 as double, 0 as double, 0 as double, ret as long
calldll #gl,"glBegin", 4 as long, ret as long
calldll #gl,"glColor3d", 0 as double, 0 as double, 255 as double, ret as long
calldll #gl,"glVertex3i", -1 as long, -1 as long, 0 as long, ret as long
calldll #gl,"glColor3d", 255 as double, 0 as double, 0 as double, ret as long
calldll #gl,"glVertex3i", 0 as long, 1 as long, 0 as long, ret as long
calldll #gl,"glColor3d", 0 as double, 255 as double, 0 as double, ret as long
calldll #gl,"glVertex3i", 1 as long, -1 as long, 0 as long, ret as long
calldll #gl,"glEnd", ret as void
calldll #gdi32,"SwapBuffers", MainDC as ulong, ret as long
#main.gr, "place 220 220"
#main.gr, "\LB Graphics and OpenGL"
#main.gr, "color red"
#main.gr, "circle 100"
wait
[quit]
calldll #gl,"wglMakeCurrent", 0 as ulong, 0 as ulong, ret as long
calldll #gl,"wglDeleteContext", GLContext as ulong, ret as long
calldll #user32, "ReleaseDC", MainH as ulong, MainDC as ulong,ret as long
close #main
close #gl
end
Re: OPEN GL
Post by bluatigro on Jan 28th, 2015, 09:12am
i rebild it to :
see last post at :
http://libertybasic.nl/viewtopic.php?f=4&t=637
error :
- my polygons are not sorting
future :
- split this in modules
- OOP [ it wil not be compatible whit LB anymore ]
Re: OPEN GL
Post by bluatigro on Jul 6th, 2015, 09:05am
update :
- sorting is now right
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637
see :
[solved] opengl : rot cube
and :
openGL : avatar robot
error :
- if i move the robot in z direction
it [ partly ] disapeers somtimes
Re: OPEN GL
Post by Richard Russell on Jul 6th, 2015, 10:51am
on Jul 6th, 2015, 09:05am, bluatigro wrote:
To make this work in LBB you must change open for graphics to open for window (in LBB graphics windows are buffered in memory, so they 'stick' without the use of flush, and OpenGL cannot render to a memory DC):
Code:open "Avatar : robot 1.0" for window as #m
This change isn't compatible with LB 4.04 because "when characterInput [key]" is rejected, so if you want to maintain compatibility you can do:
Code: if instr(Platform$, "LBB") then
open "Avatar : robot 1.0" for window as #m
else
open "Avatar : robot 1.0" for graphics as #m
end if
Richard.
Re: OPEN GL
Post by bluatigro on Jul 13th, 2015, 1:16pm
update :
- i made a minion avatar !
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637
see :
opengl : minion
Re: OPEN GL
Post by Richard Russell on Jul 13th, 2015, 1:56pm
on Jul 13th, 2015, 1:16pm, bluatigro wrote:
It's a good example of the speed benefit of LBB over LB.
When run on a 'widescreen' (16:9) display the aspect ratio isn't right (the minion is rather fat!) but my knowledge of OpenGL is not good enough to fix it.
Richard.
Re: OPEN GL
Post by RobM on Jul 13th, 2015, 11:45pm
Under the "[tmr]" branch you can decrease the first value in the two "call glScale" lines. You should be able to use DisplayWidth & DisplayHeight to calculate the correct ratio, if you are so inclined.
Code:call glScale 0.<change me>,0.3,0.3
Re: OPEN GL
Post by bluatigro on Jul 14th, 2015, 07:40am
update :
- right scale
error ? :
- the animation is a litle shaky
change the Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global winx , winy
winx = WindowWidth
winy = WindowHeight
Code:
[tmr]
scan
call glClear GL.COLOR.BUFFER.BIT or GL.DEPTH.BUFFER.BIT
call glLoadIdentity
call glTranslate .6,.3,0
call glScale 0.3*winy/winx,0.3,0.3
call glRotate angle , 0,1,0
call walk.man angle * 3 , 30
call minion
call glLoadIdentity
call glTranslate -.6,0,0
call glScale 0.3*winy/winx,0.3,0.3
call glRotate angle , 0,1,0
call robot
calldll #gdi32,"SwapBuffers" _
, MainDC as ulong _
, ret as long
angle = angle + 5
wait
Re: OPEN GL
Post by bluatigro on Jul 17th, 2015, 09:27am
update :
- scaled better
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global winx , winy , winyx
winx = WindowWidth
winy = WindowHeight
winyx = winy / winx
Code:
[tmr]
scan
call glClear GL.COLOR.BUFFER.BIT or GL.DEPTH.BUFFER.BIT
call glLoadIdentity
call glScale winyx , 1 , 1
call glPushMatrix
call glTranslate .6,.3,0
call glScale 0.3,0.3,0.3
call glRotate angle , 0,1,0
call walk.man angle * 3 , 30
call minion
call glPopMatrix
call glPushMatrix
call glTranslate -.6,0,0
call glScale 0.3,0.3,0.3
call glRotate angle , 0,1,0
call robot
call glPopMatrix
calldll #gdi32,"SwapBuffers" _
, MainDC as ulong _
, ret as long
angle = angle + 5
wait
Re: OPEN GL
Post by bluatigro on Jul 21st, 2015, 08:55am
update :
- minion whit glasses
Code:
sub minion
call setbox 0 , 1 , 0 , 1 , 1 , 1
call sphere 24 , 24 , yellow
call setbox 0 , .5 , 0 , 1 , .5 , 1
call cylinder 24 , 1 , 1 , yellow
call setbox 0 , -1 , 0 , 1 , 1 , 1
call sphere 24 , 24 , blue
call setbox 0 , -.5 , 0 , 1 , .5 , 1
call cylinder 24 , 1 , 1 , blue
call glPushMatrix
call glTranslate .4 , .7 , -.8
call glRotate 90 , 1 , 0 , 0
call setbox 0,0,0 , .4,.4,.4
call cylinder 12 , 1 , 1 , gray
call glPopMatrix
call glPushMatrix
call glTranslate -.4 , .7 , -.8
call glRotate 90 , 1 , 0 , 0
call setbox 0,0,0 , .4,.4,.4
call cylinder 12 , 1 , 1 , gray
call glPopMatrix
call glPushMatrix
call child .4 , .7 , -.8 , eye , xyz
call setbox 0,0,0 , .3,.3,.3
call sphere 12 , 12 , white
call setbox 0,0,-.3 , .1,.1,.1
call sphere 12 , 12 , black
call glPopMatrix
call glPushMatrix
call child -.4 , .7 , -.8 , eye+lr , xyz
call setbox 0,0,0 , .3,.3,.3
call sphere 12 , 12 , white
call setbox 0,0,-.3 , .1,.1,.1
call sphere 12 , 12 , black
call glPopMatrix
call glPushMatrix
call child 1 , -.3 , 0 , arm , xzy
call setbox 0,0,0 , .2,.2,.2
call sphere 12 , 12 , yellow
call setbox .2,-.5,0 , .1,.5,.1
call cylinder 12 , 1 , 1 , yellow
call glPushMatrix
call child .2 , -1 , 0 , elbow , xyz
call setbox 0,-.5,0 , .1,.5,.1
call cylinder 12 , 1 , 1 , yellow
call glPushMatrix
call child 0 , -1 , 0 , wrist , yzx
call setbox 0,-.3,0 , .15,.3,.15
call sphere 12 , 12 , yellow
call glPopMatrix
call glPopMatrix
call glPopMatrix
call glPushMatrix
call child -1 , -.3 , 0 , arm+lr , xzy
call setbox 0,0,0 , .2,.2,.2
call sphere 12 , 12 , yellow
call setbox -.2,-.5,0 , .1,.5,.1
call cylinder 12 , 1 , 1 , yellow
call glPushMatrix
call child -.2 , -1 , 0 , elbow+lr , xyz
call setbox 0,-.5,0 , .1,.5,.1
call cylinder 12 , 1 , 1 , yellow
call glPushMatrix
call child 0 , -1 , 0 , wrist+lr , yzx
call setbox 0,-.3,0 , .15,.3,.15
call sphere 12 , 12 , yellow
call glPopMatrix
call glPopMatrix
call glPopMatrix
call glPushMatrix
call child .5 , -1 , 0 , leg , yxz
call setbox 0,-.5,0 , .2,.5,.2
call cylinder 12 , 1 , 1 , blue
call glPushMatrix
call child 0 , -1 , 0 , knee , xyz
call cylinder 12 , 1 , 1 , blue
call glPushMatrix
call child 0 , -1 , 0 , enkle , zxy
call setbox 0,0,-.3 , .2,.2,.4
call cube gray,gray,gray,gray,gray,gray
call glPopMatrix
call glPopMatrix
call glPopMatrix
call glPushMatrix
call child -.5 , -1 , 0 , leg+lr , yxz
call setbox 0,-.5,0 , .2,.5,.2
call cylinder 12 , 1 , 1 , blue
call glPushMatrix
call child 0 , -1 , 0 , knee+lr , xyz
call cylinder 12 , 1 , 1 , blue
call glPushMatrix
call child 0 , -1 , 0 , enkle+lr , zxy
call setbox 0,0,-.3 , .2,.2,.4
call cube gray,gray,gray,gray,gray,gray
call glPopMatrix
call glPopMatrix
call glPopMatrix
end sub
Re: OPEN GL
Post by bluatigro on Jul 21st, 2015, 1:18pm
update :
- more shapes in subs
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637
see :
opengl : meer vormen in subs
Re: OPEN GL
Post by Richard Russell on Jul 22nd, 2015, 8:49pm
on Jul 21st, 2015, 1:18pm, bluatigro wrote:see : opengl : meer vormen in subs |
|
Direct link:
http://libertybasic.nl/viewtopic.php?f=4&t=637&start=15#p2515
Re: OPEN GL
Post by RNBW on Jul 23rd, 2015, 09:29am
This shows the difference in speed between LBB and LB!
The figures crawl and stutter in LB, whereas in LBB they move quickly and smoothly.
Re: OPEN GL
Post by bluatigro on Jul 25th, 2015, 11:27am
update :
- now whiot torus
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637&p=2517#p2517
Re: OPEN GL
Post by RNBW on Jul 25th, 2015, 2:08pm
I've not looked at the updated code, but it has improved the speed on LB and no longer stutters, although it is not showing as much on the screen (it's now just a sort of doughnut).
However, loading the code into LBB shows that it is still much quicker and smoother than LB. All credit to Richard Russell and BB4W.
OPEN GL : rainbow torus
Post by bluatigro on Jul 26th, 2015, 1:32pm
update :
- torus can have rainbow colors
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637&p=2518#p2518
warning :
if you make the sides of the totus to great or to smal
the code stops whitout showing something
Re: OPEN GL
Post by bluatigro on Jul 27th, 2015, 09:57am
update :
- camera moving
cursor :
- left , right , up , down
mouse :
- leftturn , rightturn , forwarts , backwarts
error :
- no perspectif
code at :
http://libertybasic.nl/viewtopic.php?f=4&t=637&p=2519#p2519
Re: OPEN GL
Post by Richard Russell on Jul 27th, 2015, 2:00pm
I'm puzzled that your programs run so slowly. Here's a similar thing done using Direct3D rather than OpenGL (their performance is usually similar) which runs at full frame rate! The cursor keys move the camera.
Richard.
Code:' Direct3D Demonstration
' (C) R.T.Russell 2015, http://lbbooster.com/
nomainwin
WindowWidth=DisplayWidth
WindowHeight=DisplayHeight
open "D3D8.DLL" for DLL as #d3d8
open "OLEAUT32.DLL" for DLL as #oleaut32
if instr(Platform$, "LBB") then
open "Direct3D Demonstration" for window as #w
else
open "Direct3D Demonstration" for graphics_nsb as #w
end if
#w "when characterInput [key]"
#w "trapclose [quit]"
hw=hwnd(#w)
calldll #d3d8, "Direct3DCreate8", 120 as long, IDirect3D8 as long
struct D3DDISPLAYMODE,_
Width as long, Height as long,_
RefreshRate as long, Format as long
struct parm, Adapter1 as long, pMode as struct
parm.pMode.struct=D3DDISPLAYMODE.struct
r=CallMethod(IDirect3D8, 8, parm.struct) ' ::GetAdapterDisplayMode
D3DDISPLAYMODE.struct=parm.pMode.struct
struct D3DPARMS,_
BackBufferWidth as long, BackBufferHeight as long,_
BackBufferFormat as long, BackBufferCount as long,_
MultiSampleType as long, SwapEffect as long,_
DeviceWindow as long, Windowed as long,_
EnableAutoDepthStencil as long,_
AutoDepthStencilFormat as long,_
Flags as long, FullScreenRefreshRateInHz as long,_
FullScreenPresentationInterval as long
D3DPARMS.BackBufferFormat.struct=D3DDISPLAYMODE.Format.struct
D3DPARMS.SwapEffect.struct=1
D3DPARMS.Windowed.struct=1
D3DPARMS.EnableAutoDepthStencil.struct=1
D3DPARMS.AutoDepthStencilFormat.struct=80
struct parm,_
Adapter as long, DeviceType as long, FocusWindow as ulong,_
BehaviorFlags as long, PresentationParameters as struct,_
ReturnedDeviceInterface as struct
struct temp, v as long
parm.DeviceType.struct=1
parm.FocusWindow.struct=hw
parm.BehaviorFlags.struct=32
parm.PresentationParameters.struct=D3DPARMS.struct
parm.ReturnedDeviceInterface.struct=temp.struct
r=CallMethod(IDirect3D8, 15, parm.struct) ' ::CreateDevice
temp.struct=parm.ReturnedDeviceInterface.struct
IDirect3DDevice8=temp.v.struct
' IDirect3DDevice8::SetRenderState
struct parm, State as long, Value as long
parm.State.struct=22 ' D3DRS_CULLMODE
parm.Value.struct=2
r=CallMethod(IDirect3DDevice8, 50, parm.struct)
parm.State.struct=137 ' D3DRS_LIGHTING
parm.Value.struct=0
r=CallMethod(IDirect3DDevice8, 50, parm.struct)
parm.State.struct=7 ' D3DRS_ZENABLE
parm.Value.struct=1
r=CallMethod(IDirect3DDevice8, 50, parm.struct)
triangles=12
vertices=3*triangles
vertexshader=hexdec("52")
vertexsize=28
struct temp, v as long
struct parm,_
Length as long, Usage as long, FVF as long,_
Pool as long, VertexBuffer as struct
parm.Length.struct=vertices*vertexsize
parm.FVF.struct=vertexshader
parm.VertexBuffer.struct=temp.struct
r=CallMethod(IDirect3DDevice8, 23, parm.struct) ' ::CreateVertexBuffer
temp.struct=parm.VertexBuffer.struct
IDirect3DVertexBuffer8=temp.v.struct
struct temp, v as long
struct parm,_
OffsetToLock as long, SizeToLock as long,_
ppbData as struct, Flags as long
parm.SizeToLock.struct=vertices*vertexsize
parm.ppbData.struct=temp.struct
r=CallMethod(IDirect3DVertexBuffer8, 11, parm.struct) ' ::Lock
temp.struct=parm.ppbData.struct
VertexData=temp.v.struct
for tri = 0 to 11
read c$ : c = hexdec(c$)
for ver = tri*3 to tri*3 + 2
for p=VertexData+ver*vertexsize to VertexData+ver*vertexsize+20 step 4
read r
calldll #oleaut32, "VarR4FromR8", r as double, p as long, r as void
next p
calldll #oleaut32, "VarUI4FromUI8", c as ulong, 0 as long, p as long, r as void
next ver
next tri
r=CallMethod(IDirect3DVertexBuffer8, 12, "") ' ::Unlock
struct parm, StreamNumber as long, StreamData as long, Stride as long
parm.StreamData.struct=IDirect3DVertexBuffer8
parm.Stride.struct=vertexsize
r=CallMethod(IDirect3DDevice8, 83, parm.struct) ' ::SetStreamSource
struct parm, Handle as long
parm.Handle.struct=vertexshader
r=CallMethod(IDirect3DDevice8, 76, parm.struct) ' ::SetVertexShader
timer 20, [render]
wait
[key]
select case Inkey$
case chr$(0)+chr$(37): Xcam = Xcam - 0.5
case chr$(0)+chr$(39): Xcam = Xcam + 0.5
case chr$(0)+chr$(38): Ycam = Ycam + 0.5
case chr$(0)+chr$(40): Ycam = Ycam - 0.5
end select
wait
[render]
yaw=time$("ms") / 2000
roll=time$("ms") / 800
struct parm,_
Count as long, pRects as long, Flags as long,_
BackColor as long, Z as long, Stencil as long
parm.Flags.struct=3
parm.BackColor.struct=hexdec("808080")
parm.Z.struct=float(1)
r=CallMethod(IDirect3DDevice8, 36, parm.struct) ' ::Clear
r=CallMethod(IDirect3DDevice8, 34, "") ' ::BeginScene
struct matrix,_
f11 as long, f12 as long, f13 as long, f14 as long,_
f21 as long, f22 as long, f23 as long, f24 as long,_
f31 as long, f32 as long, f33 as long, f34 as long,_
f41 as long, f42 as long, f43 as long, f44 as long
matrix.f11.struct=float(1)
matrix.f22.struct=float(1)
matrix.f33.struct=float(1)
matrix.f43.struct=float(24) ' Viewing distance
matrix.f44.struct=float(1)
struct parm, State as long, Matrix as struct
parm.State.struct=2 ' view transform
parm.Matrix.struct=matrix.struct
r=CallMethod(IDirect3DDevice8, 37, parm.struct) ' ::SetTransform
fv=0.5 ' Vertical field of view
ar=DisplayWidth / DisplayHeight ' Aspect ratio
zn=1 ' Near clipping plane
zf=1000 ' Far clipping plane
h=1/tan(fv/2)
matrix.f11.struct=float(h/ar)
matrix.f22.struct=float(h)
matrix.f33.struct=float(zf/(zf-zn))
matrix.f44.struct=float(0)
matrix.f34.struct=float(1)
matrix.f43.struct=float(0-zn*zf/(zf-zn))
parm.State.struct=3 ' projection transform
parm.Matrix.struct=matrix.struct
r=CallMethod(IDirect3DDevice8, 37, parm.struct) ' ::SetTransform
for cube = 0 to 4
Xpos = Xcam + 4*cube - 8
Ypos = Ycam
sy=sin(yaw) : cy=cos(yaw)
sp=sin(pitch) : cp=cos(pitch)
sr=sin(roll) : cr=cos(roll)
matrix.f11.struct=float(sy*sp*sr+cy*cr)
matrix.f12.struct=float(cp*sr)
matrix.f13.struct=float(cy*sp*sr-sy*cr)
matrix.f14.struct=0
matrix.f21.struct=float(sy*sp*cr-cy*sr)
matrix.f22.struct=float(cp*cr)
matrix.f23.struct=float(cy*sp*cr+sy*sr)
matrix.f24.struct=0
matrix.f31.struct=float(cp*sy)
matrix.f32.struct=float(0-sp)
matrix.f33.struct=float(cp*cy)
matrix.f34.struct=0
matrix.f41.struct=float(Xpos)
matrix.f42.struct=float(Ypos)
matrix.f43.struct=float(Zpos)
matrix.f44.struct=float(1)
struct parm, State as long, Matrix as struct
parm.State.struct=256 ' world transform
parm.Matrix.struct=matrix.struct
r=CallMethod(IDirect3DDevice8, 37, parm.struct) ' ::SetTransform
struct parm,_
PrimitiveType as long,_
StartVertex as long, PrimitiveCount as long
parm.PrimitiveType.struct=4 ' D3DPT_TRIANGLELIST
parm.PrimitiveCount.struct=triangles
r=CallMethod(IDirect3DDevice8, 70, parm.struct) ' ::DrawPrimitive
next cube
r=CallMethod(IDirect3DDevice8, 35, "") ' ::EndScene
struct parm,_
SourceRect as struct, DestRect as struct,_
DestWindowOverride as long, DirtyRegion as struct
r=CallMethod(IDirect3DDevice8, 15, parm.struct) ' ::Present
' Fix float underflow exception (LB only)
bugfix$=chr$(219)+chr$(227)+chr$(194)+chr$(16)
calldll #user32, "CallWindowProcA", bugfix$ as ptr,_
0 as long, 0 as long, 0 as long, 0 as long, r as long
wait
[quit]
r=CallMethod(IDirect3DVertexBuffer8, 2, "") ' ::Release
r=CallMethod(IDirect3DDevice8, 2, "") ' ::Release
r=CallMethod(IDirect3D8, 2, "") ' ::Release
close #w
close #oleaut32
close #d3d8
end
' Cube (12 triangles):
data "FF0000FF", 1,-1,-1, 0,-1, 0, -1,-1,-1, 0,-1, 0, -1,-1, 1, 0,-1, 0
data "FF0000FF", -1,-1, 1, 0,-1, 0, 1,-1, 1, 0,-1, 0, 1,-1,-1, 0,-1, 0
data "FF00FF00", -1, 1, 1, 0, 1, 0, -1, 1,-1, 0, 1, 0, 1, 1,-1, 0, 1, 0
data "FF00FF00", 1, 1,-1, 0, 1, 0, 1, 1, 1, 0, 1, 0, -1, 1, 1, 0, 1, 0
data "FF00FFFF", 1, 1,-1, 1, 0, 0, 1,-1,-1, 1, 0, 0, 1,-1, 1, 1, 0, 0
data "FF00FFFF", 1,-1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,-1, 1, 0, 0
data "FFFF0000", -1,-1, 1, -1, 0, 0, -1,-1,-1, -1, 0, 0, -1, 1,-1, -1, 0, 0
data "FFFF0000", -1, 1,-1, -1, 0, 0, -1, 1, 1, -1, 0, 0, -1,-1, 1, -1, 0, 0
data "FFFF00FF", 1,-1, 1, 0, 0, 1, -1,-1, 1, 0, 0, 1, -1, 1, 1, 0, 0, 1
data "FFFF00FF", -1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,-1, 1, 0, 0, 1
data "FFFFFF00", -1, 1,-1, 0, 0,-1, -1,-1,-1, 0, 0,-1, 1,-1,-1, 0, 0,-1
data "FFFFFF00", 1,-1,-1, 0, 0,-1, 1, 1,-1, 0, 0,-1, -1, 1,-1, 0, 0,-1
function float(n)
struct temp, v as long
calldll #oleaut32, "VarR4FromR8", n as double, temp as struct, r as void
float=temp.v.struct
end function
function CallMethod(object, method, parm$)
code$=chr$(139)+"D$"+chr$(4)+chr$(139)+"T$"+chr$(8)+chr$(139)+"L$" _
+ chr$(16)+"VW"+chr$(139)+"t$"+chr$(20)+chr$(43)+chr$(225)+chr$(139) _
+ chr$(252)+chr$(243)+chr$(164)+chr$(80)+chr$(139)+chr$(0)+chr$(255) _
+ chr$(20)+chr$(144)+chr$(95)+chr$(94)+chr$(194)+chr$(16)+chr$(0)
p$=parm$
n=len(p$)
calldll #user32, "CallWindowProcA", code$ as ptr, object as long,_
method as long, p$ as ptr, n as long, CallMethod as long
end function