I am trying to load a 3d mesh in Purebasic, using the builtin 3d functions. For some reason, it fails to load. Here is my code:
Code: Select all
; space invaders "3d"
InitEngine3D()
InitSprite()
InitKeyboard()
mWnd = OpenWindow(#PB_Any,0,0,1024,768,"Space Invaders 3d", #PB_Window_ScreenCentered| #PB_Window_Normal)
OpenWindowedScreen(WindowID(mWnd),0,0,1024,768,1,0,0,#PB_Screen_SmartSynchronization)
Add3DArchive("C:\pb\mi_space_invaders\",#PB_3DArchive_FileSystem)
Parse3DScripts()
ship_mesh = LoadMesh(#PB_Any,"Cube.mesh")
CallDebugger
ship = CreateEntity(#PB_Any,ship_mesh,#PB_Material_None)
EntityLocate(ship,0,0,0)
cam = CreateCamera(#PB_Any,0,0,1024,768)
CameraLocate(cam,0,2,0)
RotateCamera(cam,90,0,0)
ExamineKeyboard()
Repeat
ev = WindowEvent()
ExamineKeyboard()
RenderWorld()
FlipBuffers()
Until ev = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
- Modeled in Blender 2.5 and exported as .dae
- Imported into Blender 2.49 and exported as .mesh.xml with the OGRE exporter plugin
- Converted to .mesh with Ogre Command Line Tools
The code fails in the call to CreateEntity(), saying that "The specified mesh is null". With CallDebugger, I can see that the value of ship_mesh is, indeed, 0 after the call to LoadMesh(). Am I missing something?


