bitmap texture not loading

Software: Away3D 3.x

faroer, Newbie
Posted: 24 October 2011 12:35 PM   Total Posts: 18

Hey Away3D community,

I’m trying to add a texture to a custom made model.

I can get the model loading in away3d and it shows also. But for some reason it won’t load the texture. Flash is not giving any errors or warnings about.

package 
{
 import away3d
.cameras.*;
 
import away3d.containers.*;
 
import away3d.primitives.*;
 
import away3d.core.utils.*;
 
import away3d.materials.*;
 
 
import models.common.PlanetWinter;
 
 
import flash.display.*;
 
import flash.events.*;
 
import away3d.events.MaterialEvent;

 public class 
pictor extends Sprite
 {
  
protected var _view View3D;
  protected var 
_camera HoverCamera3D;
  protected var 
_cube Cube;
  protected var 
_sphere Sphere;
  protected var 
_planet PlanetWinter;
  protected var 
_planetMaterial BitmapFileMaterial;
  
  protected var 
_state int 0;
  

  public function 
pictor()
  
{
   _createView
();
   
_createScene();
  
}
  
  
protected function _createView() : void
  {
   _camera 
= new HoverCamera3D;
   
_camera.distance 150;
   
_camera.tiltAngle 10;
   
   
_view = new View3D;
   
_view.512;
   
_view.384;
   
_view.camera _camera;
   
addChild(_view);
   
   
stage.addEventListener(Event.ENTER_FRAME_onEnterFrame);
  
}
  
  
protected function _createScene():void
  {
   _cube 
= new Cube;
   
_cube.width 30;
   
_cube.height 30;
   
_cube.depth 30;
   
_cube.70;
   
_view.scene.addChild(_cube);
   
   
_sphere = new Sphere;
   
_sphere.radius 25;
   
_sphere.= -70;
   
_view.scene.addChild(_sphere);
   
   
_planetMaterial = new BitmapFileMaterial("textures/textureplanet1.jpg");
   
   
_planet = new PlanetWinter;
   
_planet.material _planetMaterial;
   
_view.scene.addChild(_planet);
  
}
  
  
protected function _onEnterFrame(e:Event):void
  {
   _camera
.panAngle -= (stage.mouseX stage.stageWidth 2) / 100;
   
_camera.hover();
   
   
_view.render();
  
}

 }

   

Avatar
maddog, Sr. Member
Posted: 24 October 2011 06:38 PM   Total Posts: 118   [ # 1 ]

I had same prob. Dd you make sure image dimensions are a multiple of 2.

   

faroer, Newbie
Posted: 24 October 2011 06:48 PM   Total Posts: 18   [ # 2 ]
maddog - 24 October 2011 06:38 PM

I had same prob. Dd you make sure image dimensions are a multiple of 2.

The image dimensions are both 1000px. Still does not work… No errors or warnings…

   

eclectrik, Newbie
Posted: 24 October 2011 06:49 PM   Total Posts: 19   [ # 3 ]

By multiple of 2 ( this confused me also ) he means for example:

256x256
512x512 ( i think.. )
1024x1024
etc etc

1000x1000px will not work, try resizing!

   

faroer, Newbie
Posted: 24 October 2011 06:52 PM   Total Posts: 18   [ # 4 ]
eclectrik - 24 October 2011 06:49 PM

By multiple of 2 ( this confused me also ) he means for example:

256x256
512x512
1024x1024
etc etc

1000x1000px will not work, try resizing!

I resized it to 512x512 and tried it again.

It’s not working either. This is really frustating me. I’m only having trouble with away the last few days…. Yet again no errors or warnings from Flash.

   

eclectrik, Newbie
Posted: 24 October 2011 06:55 PM   Total Posts: 19   [ # 5 ]

Sorry i think 512 is wrong try either 256 or 1024 my maths is lacking..

   

faroer, Newbie
Posted: 24 October 2011 07:01 PM   Total Posts: 18   [ # 6 ]
eclectrik - 24 October 2011 06:55 PM

Sorry i think 512 is wrong try either 256 or 1024 my maths is lacking..

hmmm… 256, 1024 doesn’t seem to work either….
What am I doing wrong….

   

eclectrik, Newbie
Posted: 24 October 2011 07:05 PM   Total Posts: 19   [ # 7 ]

Hmmm sorry beyond that i can`t help still learning myself!  Took me around 2 days to figure out that i had to scale textures though which was really annoying smile

 

   

faroer, Newbie
Posted: 24 October 2011 07:08 PM   Total Posts: 18   [ # 8 ]
eclectrik - 24 October 2011 07:05 PM

Hmmm sorry beyond that i can`t help still learning myself!  Took me around 2 days to figure out that i had to scale textures though which was really annoying smile

I really appreciate your help though smile
The code seems fine to me…

   

Avatar
maddog, Sr. Member
Posted: 24 October 2011 08:21 PM   Total Posts: 118   [ # 9 ]

maybe try giving full path for image, or imbedding the image to see if is a file location issue.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X