Author Topic: Loading images  (Read 1079 times)

Offline Irene

  • byte
  • *
  • Posts: 1
    • View Profile
Loading images
« on: August 19, 2011, 12:16:25 pm »
My question is probably trivial, but I can't find a solution because I am very new in jpct and 3D at all.
I have an image file 256x256 jpg and I want to load it as texture on primitive created like that:
Code: [Select]
Object3D myBox = null;
myBox = Primitives.getBox(21f, 2f);
I loading a texture this way:
Code: [Select]
TextureManager tm = TextureManager.getInstance();
Texture test = new Texture(Main.getTexture("/resources/test.jpg")); // getTexture code works well with another image
tm.addTexture("test", test);
But when I have done so I can not see my image on box. In the same time when I loading the same way “rocks.jpg” image from samples, my box became green and texture works.
What am I doing wrong?
 Please somebody tell me, how can I place my pic or text for example on primitive or a model?

Also I have the second trivial question:
How can I know the angle between camera and  world's Y coordinate axis   in degrees? I had tried different ways , like that for example
Code: [Select]
but I completely messed up with results and was unable to detect camera direction relatively to world's Y-axis. Could you help me, please?

Thank you!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12219
    • View Profile
Re: Loading images
« Reply #1 on: August 19, 2011, 02:14:29 pm »
Keep in mind that objects created by the Primitives class have no texture coordinates (see also: Maybe that's your problem rather than the loading of the texture itself? If not, post the log output please.

About your second question...maybe this is helpful: