wrapping a model with a bitmap

Blitz3D Forums/Blitz3D Beginners Area/wrapping a model with a bitmap

Blitzplotter(Posted 2007) [#1]
Hi, I am trying to apply a texture to a model I have created in Wings within my ODE world. I've textured simple cuboids successfully, however my attempt at adding the texture to a more complex model is as follows - (it fails to compile when I incorporate the Entity Texture command with a memory access violation which I have associated in the past with failing to load the bitmap.) This isn't the case here, i'm using the same bitmap to map a texture to a cuboid.:

Function AddMario()

ode.ODEGeom=New ODEGeom

ode\body=dBodyCreate(World)  

dBodySetAutoDisableFlag(ode\body,1)

ode\mesh=LoadMesh("wings tracks\track_10_b3d.b3d")
ScaleMesh ode\mesh,15,15,15
RotateMesh ode\mesh,0,0,180  ;*1
PositionMesh ode\mesh,200,0,180 ;*2
EntityColor ode\mesh,Rand(255),Rand(255),Rand(255)
;EntityTexture ode\mesh, build_txt      fails to compile if try this

EntityAlpha ode\mesh,1
EntityShininess ode\mesh,0.7

ode\geom=CreateTriMesh( Space,ode\mesh)
End Function



I have unwrapped my model within UU3D, attempted to use UU3D to try and create a mesh? (failed...) then referred to page 90 and 91 of the B3D manual regarding texturing. Any help appreciated, regards - BP. The 3d model I'm trying to wrap a texture round is the blue one in the middle of the following image:-




Ross C(Posted 2007) [#2]
You need to make sure the texture exists before you try and texture a model. If you do:

Texture = loadtexture("texture.bmp")

The above is just for example purposes. Then check the texture by doing:

If texture = 0 then RunTimeError("Texture is not loaded")

If that doesn't work, then, keep in mind your texture is being applied inside a function. So, if you don't give the texture a gloabl reference:

Global texture = LoadTexture("Texture.bmp")

If that doesn't work, then i'm stumped.


Blitzplotter(Posted 2007) [#3]
Thanks Ross, I turned the image into a global prior to loading it and that resolved the problem. It seems my function didn't have visibility of the texture.


Blitz3dCoder(Posted 2007) [#4]
when u gonna give us a zip 4 this?


Blitz3dCoder(Posted 2007) [#5]
I found one, and for anybody who wants is, it is HERE


Blitzplotter(Posted 2007) [#6]
I've got a newer version without the green and white tiled floor and gasp... levels! might upload it this weekend.

its here:-

http://myweb.tiscali.co.uk/diecastcars/endzone/endzone.htm