www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: sokobozz on June 28, 2009, 10:38:51 AM

Title: how to apply solid color on primitives
Post by: sokobozz on June 28, 2009, 10:38:51 AM
Hi!

Well I am new in java 3d. I look jpct demos and they look fantastic. I want to quick play with jpct but I have problem with applying simple solid color on primitives. I want to avoid creating textures in Gimp or Blender. Is this possible with jpct?
Title: Re: how to apply solid color on primitives
Post by: EgonOlsen on June 28, 2009, 11:18:10 AM
Either use http://www.jpct.net/doc/com/threed/jpct/Object3D.html#setAdditionalColor(java.awt.Color) (http://www.jpct.net/doc/com/threed/jpct/Object3D.html#setAdditionalColor(java.awt.Color)) or create a colored texture using http://www.jpct.net/doc/com/threed/jpct/Texture.html#Texture(int,%20int,%20java.awt.Color) (http://www.jpct.net/doc/com/threed/jpct/Texture.html#Texture(int,%20int,%20java.awt.Color)). Just use what gives you the best results.
Title: Re: how to apply solid color on primitives
Post by: sokobozz on June 28, 2009, 11:36:41 AM
Well I already tried this, but no success on this. I get only black box(without my texture)!

so the part of code  is here:


      Texture red = new Texture(8,8, Color.RED);
      TextureManager.getInstance().addTexture("red", red);
      box = Primitives.getBox(10f, 1f);
      box.setTexture("red");
      box.setEnvmapped(Object3D.ENVMAP_ENABLED);
      box.build();

Title: Re: how to apply solid color on primitives
Post by: EgonOlsen on June 28, 2009, 12:19:22 PM
Try in increase the value for ambient light in world. Maybe your scene is just too dark.
Title: Re: how to apply solid color on primitives
Post by: sokobozz on June 29, 2009, 10:38:43 AM
I added more light and it's ok now.
Thanks.