Ultimate3D
Posted: Mon May 10, 2010 2:41 pm
Hello there, has anyone successfully used the Ultimate3D dll (for GameMaker) with PureBasic?
I've had limited success but when the program ends, I encounter a "readmemory" error like
maybe some memory not being released when U3D exits. Thoughts?
Scotty
;*******************************************************************************************
hwnd.d=OpenWindow(1,20,20,640,480,"Untitled",#PB_Window_SystemMenu)
If hwnd=0 Or InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0 Or InitSound()=0 Or InitMovie()=0:End:EndIf
ws.d=OpenWindowedScreen(WindowID(1),0,0,1,1,0,0,0)
OpenLibrary(0,"C:\Documents and Settings\root\Desktop\USB\SDK\Ultimate3D.dll")
Prototype.d InitUltimate3D1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d)
InitUltimate3D.InitUltimate3D1 = GetFunction(0, "InitUltimate3D")
Prototype.d Cleanup1():Cleanup.Cleanup1 = GetFunction(0, "Cleanup")
Prototype.d Render1():Render.Render1 = GetFunction(0, "Render")
Prototype.d Present1():Present.Present1 = GetFunction(0, "Present")
Prototype.d SwitchView1():SwitchView.SwitchView1 = GetFunction(0, "SwitchView")
Prototype.d LoadBackground1(p0.s):LoadBackground.LoadBackground1 = GetFunction(0, "LoadBackground")
Prototype.d CreateCube1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d,p10.d)
CreateCube.CreateCube1 = GetFunction(0, "CreateCube")
Prototype.d TransmitControllerInformation1(p0.d,p1.d,p2.d,p3.d)
TransmitControllerInformation.TransmitControllerInformation1 = GetFunction(0, "TransmitControllerInformation")
Prototype.d TakeScreenshot1(p0.s):TakeScreenshot.TakeScreenshot1 = GetFunction(0, "TakeScreenshot")
Prototype.d DestroyCamera1(p0.d):DestroyCamera.DestroyCamera1 = GetFunction(0, "DestroyCamera")
Prototype.d UpdateCameraTransformation1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d)
UpdateCameraTransformation.UpdateCameraTransformation1 = GetFunction(0, "UpdateCameraTransformation")
Prototype.d UpdateCameraProjection1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d)
UpdateCameraProjection.UpdateCameraProjection1 = GetFunction(0, "UpdateCameraProjection")
Prototype.d TransmitString1(p0.d,p1.s):TransmitString.TransmitString1 = GetFunction(0, "TransmitString")
Prototype.d LoadTexture1(p0.s,p1.d,p2.d,p3.d):LoadTexture2.LoadTexture1 = GetFunction(0, "LoadTexture")
Prototype.d SetTexturePath1(p0.s):SetTexturePath.SetTexturePath1 = GetFunction(0, "SetTexturePath")
TransmitString(0,"C:\controller1.bmp")
TransmitString(1,"C:\u3d.txt")
TransmitString(2,"")
InitUltimate3D(hwnd,0,0,640,480,32,2,1,0,0)
LoadBackground("C:\Documents and Settings\root\Desktop\USB\TechDemo\gfx\Transitions\ToolsAndToons.png")
number.d=0
x.d=0
y.d=0
z.d=0
height.d=5
rotx.d=0
roty.d=0
rotz.d=0
distance.d=10
min_range.d=0.5
max_range.d=100000
view.d=90
v_left.d=0
v_top.d=0
v_width.d=640
v_height.d=480
actual_aspect.d=0
render_target.d=0
quit=0
Repeat
WindowEvent()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape):quit=1:EndIf
If KeyboardPushed(#PB_Key_Left)
rotx=rotx+1
UpdateCameraTransformation(number,x,y,z+height,rotx,roty,rotz)
UpdateCameraProjection(number,min_range,max_range,view,v_left,v_top,v_width,v_height,actual_aspect,render_target)
EndIf
If KeyboardPushed(#PB_Key_Right)
rotx=rotx-1
UpdateCameraTransformation(number,x,y,z+height,rotx,roty,rotz)
UpdateCameraProjection(number,min_range,max_range,view,v_left,v_top,v_width,v_height,actual_aspect,render_target)
EndIf
Present()
TransmitControllerInformation(0,0,0,1)
Render()
Until quit=1
Cleanup()
CloseLibrary(0)
CloseWindow(1)
End
;*****************************************************************************************
I've had limited success but when the program ends, I encounter a "readmemory" error like
maybe some memory not being released when U3D exits. Thoughts?
Scotty
;*******************************************************************************************
hwnd.d=OpenWindow(1,20,20,640,480,"Untitled",#PB_Window_SystemMenu)
If hwnd=0 Or InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0 Or InitSound()=0 Or InitMovie()=0:End:EndIf
ws.d=OpenWindowedScreen(WindowID(1),0,0,1,1,0,0,0)
OpenLibrary(0,"C:\Documents and Settings\root\Desktop\USB\SDK\Ultimate3D.dll")
Prototype.d InitUltimate3D1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d)
InitUltimate3D.InitUltimate3D1 = GetFunction(0, "InitUltimate3D")
Prototype.d Cleanup1():Cleanup.Cleanup1 = GetFunction(0, "Cleanup")
Prototype.d Render1():Render.Render1 = GetFunction(0, "Render")
Prototype.d Present1():Present.Present1 = GetFunction(0, "Present")
Prototype.d SwitchView1():SwitchView.SwitchView1 = GetFunction(0, "SwitchView")
Prototype.d LoadBackground1(p0.s):LoadBackground.LoadBackground1 = GetFunction(0, "LoadBackground")
Prototype.d CreateCube1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d,p10.d)
CreateCube.CreateCube1 = GetFunction(0, "CreateCube")
Prototype.d TransmitControllerInformation1(p0.d,p1.d,p2.d,p3.d)
TransmitControllerInformation.TransmitControllerInformation1 = GetFunction(0, "TransmitControllerInformation")
Prototype.d TakeScreenshot1(p0.s):TakeScreenshot.TakeScreenshot1 = GetFunction(0, "TakeScreenshot")
Prototype.d DestroyCamera1(p0.d):DestroyCamera.DestroyCamera1 = GetFunction(0, "DestroyCamera")
Prototype.d UpdateCameraTransformation1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d)
UpdateCameraTransformation.UpdateCameraTransformation1 = GetFunction(0, "UpdateCameraTransformation")
Prototype.d UpdateCameraProjection1(p0.d,p1.d,p2.d,p3.d,p4.d,p5.d,p6.d,p7.d,p8.d,p9.d)
UpdateCameraProjection.UpdateCameraProjection1 = GetFunction(0, "UpdateCameraProjection")
Prototype.d TransmitString1(p0.d,p1.s):TransmitString.TransmitString1 = GetFunction(0, "TransmitString")
Prototype.d LoadTexture1(p0.s,p1.d,p2.d,p3.d):LoadTexture2.LoadTexture1 = GetFunction(0, "LoadTexture")
Prototype.d SetTexturePath1(p0.s):SetTexturePath.SetTexturePath1 = GetFunction(0, "SetTexturePath")
TransmitString(0,"C:\controller1.bmp")
TransmitString(1,"C:\u3d.txt")
TransmitString(2,"")
InitUltimate3D(hwnd,0,0,640,480,32,2,1,0,0)
LoadBackground("C:\Documents and Settings\root\Desktop\USB\TechDemo\gfx\Transitions\ToolsAndToons.png")
number.d=0
x.d=0
y.d=0
z.d=0
height.d=5
rotx.d=0
roty.d=0
rotz.d=0
distance.d=10
min_range.d=0.5
max_range.d=100000
view.d=90
v_left.d=0
v_top.d=0
v_width.d=640
v_height.d=480
actual_aspect.d=0
render_target.d=0
quit=0
Repeat
WindowEvent()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape):quit=1:EndIf
If KeyboardPushed(#PB_Key_Left)
rotx=rotx+1
UpdateCameraTransformation(number,x,y,z+height,rotx,roty,rotz)
UpdateCameraProjection(number,min_range,max_range,view,v_left,v_top,v_width,v_height,actual_aspect,render_target)
EndIf
If KeyboardPushed(#PB_Key_Right)
rotx=rotx-1
UpdateCameraTransformation(number,x,y,z+height,rotx,roty,rotz)
UpdateCameraProjection(number,min_range,max_range,view,v_left,v_top,v_width,v_height,actual_aspect,render_target)
EndIf
Present()
TransmitControllerInformation(0,0,0,1)
Render()
Until quit=1
Cleanup()
CloseLibrary(0)
CloseWindow(1)
End
;*****************************************************************************************