Loading a mesh

Blitz3D Forums/Blitz3D Beginners Area/Loading a mesh

Yo! Wazzup?(Posted 2007) [#1]
How do you load a mesh, give it a texture and show it? Camera movement in your example would be nice.


Thanks!!!


skidracer(Posted 2007) [#2]
If I were you I'd study the example programs that come with Blitz3D, the teapot example in the mak folder would be a good starting point.


Yo! Wazzup?(Posted 2007) [#3]
I looked at the teapot example, and when I tried to change the mesh to one that was in the same folder, it gave me an error.


Yo! Wazzup?(Posted 2007) [#4]
Shouldn't this work?
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
light=CreateLight()
mesh=LoadMesh ("mesh.x")
tex=LoadTexture ("texture.jpg")
EntityTexture mesh,tex
PositionEntity mesh, 1,0,5
While Not KeyDown(1)
RenderWorld
Flip
Wend
End



Yahfree(Posted 2007) [#5]
Well, that "Mesh" might be big enough that your "inside" of it.. and if i'm not mistakin triangles face outwards unless fliped so you won't see anything if you inside of it, try the "FlipMesh mesh" command, if you see stuff then you know your inside of it, now take it off and scale the mesh down with "ScaleEntity mesh,.5,.5,.5" this will scale it down by 50%.

if you still don't see it, scale the crap out of it till you do, if not then i don't see why not unless the mesh your trying to load is a different format then .x

hope this helps

EDIT: did you check to see if your mesh file is in the same folder as the source file?


b32(Posted 2007) [#6]
It is possible the mesh cannot be loaded.
Try:
Graphics3D 640,480
mesh=LoadMesh ("mesh.x")
print mesh

If mesh is zero, there was a problem loading it.
Are you sure the mesh is in the same folder ? You could try checking the FileType() before loading it. If it returns a one, the file exists, else it returns zero.
Print FileType("mesh.x")


jfk EO-11110(Posted 2007) [#7]
Note only directX 7 compilant .X meshes can be loaded.


Yo! Wazzup?(Posted 2007) [#8]
sorry, I didn't save the program before I ran it. It works now. :P