EntityTexture on a Cube not working
BlitzMax Forums/MiniB3D Module/EntityTexture on a Cube not working
| ||
Hi I'm now trying to get my cube textured but have hit another brick wall. I can colour the wall with EntityColor but texturing it seems to not work at all and it just ends up grey like it does with no texture. I've tried with my own texture and also the logo one bundled in the download. Also I tried testing whether the texture actually loaded by printing the width and that was correct. thanks [bbcode] ?linux Import"-ldl" ? Import sidesign.minib3d SuperStrict Local type_camera:Int = 1 Local type_cube:Int = 2 'Load Textures Local tBricks:TTexture = LoadTexture("data/bricks2.png") Graphics3D 800 , 600 , 32 , 2 'Camera Local player:TMesh = createSphere() EntityAlpha(player, 0) Local camera:TCamera = CreateCamera(player) EntityType player , type_camera 'Light Local light:TLight = CreateLight() RotateEntity light , 90 , 0 , 0 'Cube Local mCube:TMesh = CreateCube() PositionEntity mCube, 0, 0, 5 EntityTexture mCube, tBricks, 0, 0 EntityType mCube, type_cube 'EntityColor mCube, 255, 0, 0 Collisions type_camera, type_cube, 2, 2 Repeat If KeyDown(KEY_W) MoveEntity player , 0 , 0 , .1 EndIf If KeyDown(KEY_S) MoveEntity player , 0 , 0 , - .1 EndIf If KeyDown(KEY_Q) MoveEntity player , - .1 , 0 , 0 EndIf If KeyDown(KEY_E) MoveEntity player , .1 , 0 , 0 EndIf If KeyDown(KEY_A) TurnEntity player , 0 , 1 , 0 EndIf If KeyDown(KEY_D) TurnEntity player , 0 , -1 , 0 EndIf UpdateWorld RenderWorld Flip Until KeyHit(KEY_ESCAPE) Or AppTerminate() [/bbcode] Last edited 2013 |
| ||
Load textures *after* calling Graphics3D - not before. And check the return value for null to be sure the texture really loaded. Last edited 2013 |
| ||
thanks a lot |