I'm working on a program that allows you to create meshes and then save them. For some reason though ,when i save the mesh, it sometimes creates a blank mesh file.
Not every time though. Half of the time it saves perfect and i can load the mesh into a program with no problem. At first i thought it was the file path, but the strange thing is that they all use the same file path. So they should all work or none of them should work. Not sure if this matters, but it seems like only meshes that are 2kb or less actually save properly. I hope I'm explaining this right and thanks to anyone who takes the time to read this.
Having trouble with SaveMesh
Re: Having trouble with SaveMesh
Have you an error in your ogre.log ?
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: Having trouble with SaveMesh
Unfortunately, there is no error that's reported. Which makes this tough to track down. It saves and creates the mesh file with no problem, but then sometimes the mesh file has a 0kb file size. If you open it in notepad its completely blank. I'll keep trying to track it down and hopefully I'll be able to post some more information later.
EDIT:
OK I've tested it further and now I'm positive that it only fails if the the mesh file would be over 2kb in size. I have saved about 20 different meshes that were all under 2kbs
and everyone worked perfect. I have yet to get one to save that's over 2kbs. I am starting to think that this may be a bug in purebasic.
Just so you know im using the new purebasic 5.00 beta2 x64 on windows 7.
EDIT:
OK I've tested it further and now I'm positive that it only fails if the the mesh file would be over 2kb in size. I have saved about 20 different meshes that were all under 2kbs
and everyone worked perfect. I have yet to get one to save that's over 2kbs. I am starting to think that this may be a bug in purebasic.
Just so you know im using the new purebasic 5.00 beta2 x64 on windows 7.
Re: Having trouble with SaveMesh
I meant to post this last week, but I've been busy with work. This code loads the Robot.mesh that comes with purebasic and then saves it, but the result will be an empty or nonexistent mesh file. I'm sure you guys know this, but you will have to change the file paths for the loading and saving. As posted above this code does work if the mesh is under 2kbs, but the robot mesh is about 140kbs so you should be able to see the mess up. I thought it might be a time issue. Like maybe it takes 5 or so seconds to complete the mesh file, but i've let it sit for several minutes before and it still gets the same result.
Thanks again for any help and hopefully you guys might be able to help me solve this.
One more thing i noticed is that on 5.0 beta2 it creates the mesh, but its empty. Whereas version 4.7beta doesn't create a mesh file at all.
Thanks again for any help and hopefully you guys might be able to help me solve this.
One more thing i noticed is that on 5.0 beta2 it creates the mesh, but its empty. Whereas version 4.7beta doesn't create a mesh file at all.
Code: Select all
If InitEngine3D()
Else
MessageRequester("Information", "ERROR///The 3D Engine Could Not Be Loaded.", 0)
End
EndIf
If InitSprite()
Else
MessageRequester("Information", "ERROR///Could Not Activate InitSprite.", 0)
End
EndIf
If OpenWindow(0, 0, 0, 800, 600, "Load And Save A Mesh", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
Add3DArchive("C:/PureBasic/Examples/3D/Data/Models", #PB_3DArchive_FileSystem)
result=LoadMesh(17, "C:/PureBasic/Examples/3D/Data/Models/Robot.mesh")
Debug result
SaveMesh(17, "C:/RobotV2.mesh")
EndIf
EndIf
End
Re: Having trouble with SaveMesh
Are you sure that the robot is 140 kbs? here 42 kb
This work for me, i can use RobotV2.mesh
This work for me, i can use RobotV2.mesh
Code: Select all
InitEngine3D()
InitSprite()
If OpenWindow(0, 0, 0, 800, 600, "Load And Save A Mesh", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Models", #PB_3DArchive_FileSystem)
result=LoadMesh(0, "Robot.mesh")
Debug result
SaveMesh(0, #PB_Compiler_Home + "Examples/3D/Data/Models/RobotV2.mesh")
EndIf
EndIf
End
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: Having trouble with SaveMesh
Your right about the size and i tried your code and it works perfect. I still have a problem though. My main program still doesn't save properly, but its essentially the same code. Just much greater in size because of the mesh creation. So I'm wondering is there anything that can conflict with the savemesh.
EDIT:
OK I've kinda figured out the problem. It seems to save fine if i save right after i create or load the mesh, but if i go off into another routine and then save it fails.
Which isn't a big deal. I'll just save after mesh creation. Thanks for all the help.
EDIT:
OK I've kinda figured out the problem. It seems to save fine if i save right after i create or load the mesh, but if i go off into another routine and then save it fails.
Which isn't a big deal. I'll just save after mesh creation. Thanks for all the help.