Help please

Blitz3D Forums/Blitz3D Programming/Help please

Yue(Posted 2012) [#1]
I am getting an error in Windows 7 64-bit at the time of leaving the game, someone can tell me what happens.




Rroff(Posted 2012) [#2]
Could be threads or other handles you are forgetting to close/clean up before the program ends?


Yue(Posted 2012) [#3]
@Roff

Thanks for responding, I have discovered the cause of the problem but still no solution.

Use wraper PhysX for physics in my project, and the error occurs when using fabrics and closing windows 7 64-bit error occurs.

Truth does not know how to fix.

Graphics3D 800,600,32,2
SetBuffer BackBuffer()
pxRegWriteDriverPath ("Drivers PhysX")

;Lights
light01=CreateLight()
PositionEntity light01,0,60,-15
RotateEntity light01,30,0,0
AmbientLight 255,255,255

;Plane
plane=CreatePlane()
EntityColor plane,100,200,100
EntityAlpha plane, 0.5
m=CreateMirror ()

;Camera
Global cam=CreateCamera()
PositionEntity cam,0,35,-55
RotateEntity cam,30,0,0

tex = LoadTexture ("Logo.jpg")
;---------- Create Cloth Meshes----------
cloth_mesh1 = LoadMesh ("pol.b3d")
EntityTexture cloth_mesh1,tex
;RotateMesh cloth_mesh1,-90,0,0
PositionEntity cloth_mesh1,30,30,0
EntityFX cloth_mesh1,16
MeshHeight (cloth_mesh1)
surf1 = GetSurface (cloth_mesh1,1 )

cloth_mesh2 = LoadMesh ("pol.b3d")
EntityTexture cloth_mesh2,tex
PositionEntity cloth_mesh2,-30,30,0
EntityFX cloth_mesh2,16
MeshHeight (cloth_mesh2)
surf2 = GetSurface (cloth_mesh2,1 )

cloth_mesh3 = LoadMesh ("pol.b3d")
EntityTexture cloth_mesh3,tex
PositionEntity cloth_mesh3,0,30,0
EntityFX cloth_mesh3,16
MeshHeight (cloth_mesh3)
surf3 = GetSurface (cloth_mesh3,1 )

;PX
pxCreateWorld(1, "key")					
pxSetGravity(0,-10,0)				

 ocu.Px_Cube = New Px_Cube
		ocucube_body=pxBodyCreateCube(12,1,2, 0)
		pxBodySetPosition(ocucube_body, 30,30,10)
 		ocucube_mesh=CreateCube()
		ScaleEntity ocucube_mesh,12,1,2
		EntityColor ocucube_mesh,Rand(0,255),Rand(0,255),Rand(0,255)


 ocu.Px_Cube = New Px_Cube
		ocucube_body=pxBodyCreateCube(12,1,1, 15)
		pxBodySetPosition(ocucube_body, 30,30,-10)
 		ocucube_mesh=CreateCube()
		ScaleEntity ocucube_mesh,12,1,1
		EntityColor ocucube_mesh,Rand(0,255),Rand(0,255),Rand(0,255)


;------------ Create cloth--------------------------
cloth1_body = pxCreateCloth(cloth_mesh1, surf1)
cloth2_body = pxCreateCloth(cloth_mesh2, surf2)
cloth3_body = pxCreateCloth(cloth_mesh3, surf3)

;---------------- Attach Cloth---------------------
pxClothAttachVertexToPos (cloth3_body, 399, -10,30,10)
pxClothAttachVertexToPos (cloth3_body, 440, 9,30,10)

pxClothAttachVertexToPos (cloth2_body, 399, -39,30,10)
pxClothAttachVertexToPos (cloth2_body, 440, -21,30,10)
pxClothAttachVertexToPos (cloth2_body, 1, -39,20,-8)
pxClothAttachVertexToPos (cloth2_body, 40, -21,20,-8)

pxClothAttachToCollidingShapes(cloth1_body, 0)

pxClothSetBendingStiffness (cloth3_body, 1)
pxClothSetBendingStiffness (cloth1_body, 1)



Repeat
	
	
	
If KeyHit(57) Create_Px_Cube()

x#=0: y#=0: z#=0 
If KeyDown( 203 ) Then x#=-0.2 
If KeyDown( 205 ) Then x#=0.2 
If KeyDown( 208 ) Then y#=-0.2 
If KeyDown( 200 ) Then y#=0.2 
If KeyDown( 44 ) Then z#=-0.2 
If KeyDown( 30 ) Then z#=0.2
If KeyDown( 2 ) Then ry = ry+1
If KeyDown( 3 ) Then ry = ry-1 
RotateEntity cam,0,ry,0

MoveEntity cam,x#,y#,z#

time=MilliSecs ()
;-------Update cloth and World-------
pxUpdateCloth()
	Update_Px_Cube()
	pxRenderPhysic(30,0)		
New_time=MilliSecs ()-time




pxSetPause(1)
UpdateWorld()
RenderWorld()
   frames=frames+1  
   If MilliSecs()-render_time=>1000  fps1=frames : frames=0 : render_time=MilliSecs()  
   Text 10,10,"FPS: "+fps1+"  DLL Time: "+ New_time
   Text 10,20,"1 - delete Cloth"

Flip 

Until KeyHit(1)
;pxClothDetachFromShape(Int Cloth, Int body)
pxDestroyWorld()
End

Type Px_Cube
	Field cube_body%
	Field cube_mesh%
End Type

Function Create_Px_Cube()
   ocu.Px_Cube = New Px_Cube
		ocucube_body=pxBodyCreateCube(1,1,1, 3)
 		ocucube_mesh=CreateCube()
		ScaleEntity ocucube_mesh,1,1,1
		EntityColor ocucube_mesh,Rand(0,255),Rand(0,255),Rand(0,255) 
		pxBodySetPosition(ocucube_body,EntityX(cam)+Rand(-5,5),EntityY(cam)+Rand(-5,5),EntityZ(cam))
		pxBodySetRotation(ocucube_body,Rand(-90,90),Rand(-90,90),Rand(-90,90))

	  pxBodyAddForce(ocucube_body, 0, 0, 50, 2)
		
 End Function

 Function Update_Px_Cube()
	For ocu.Px_Cube = Each Px_Cube
         pxBodySetEntity(ocucube_mesh, ocucube_body)
	Next
End Function