After the statement:
sphere = LoadMesh("sphere.b3d")
check the value of the variable sphere.
If it is 0 or null, then the .b3d file has not been loaded for some reason. As stated in the above posts, it could be that the exported .b3d file is made in a wrong format, hence it is not properly loaded.
You can try to post a link to the .b3d file you are using, so it can be downloaded; perhaps this help us to find out what's wront with its format.
Sergio.
P.S.
if you use the variable 'sphere' from within a function, you may better declare it as Global in the main section of the code.
sphere = LoadMesh("sphere.b3d")
check the value of the variable sphere.
If it is 0 or null, then the .b3d file has not been loaded for some reason. As stated in the above posts, it could be that the exported .b3d file is made in a wrong format, hence it is not properly loaded.
You can try to post a link to the .b3d file you are using, so it can be downloaded; perhaps this help us to find out what's wront with its format.
Sergio.
P.S.
if you use the variable 'sphere' from within a function, you may better declare it as Global in the main section of the code.