Set a Color for an object3D

Started by Melssj5, May 18, 2006, 08:49:43 AM

Previous topic - Next topic

Melssj5

Object3D.setColor ();

Hi, how can I set a color for a Object3D?? I know I can add it a texture with the setTexture () method. But what i I dont want to load a image but just use a Color!!!!!!

It should be a method called setColor or something on the Object3D!!

ANyway. What can I do to get my primitives painted on a rgb color??
Nada por ahora

EgonOlsen

Assign a single colored texture (8x8 or 16x16) to it. jPCT is texture mapping only by design. There is no way to disable it. The 3ds loader does exactly the same thing for textureless materials (as the docs state).

Melssj5

So, Its imposible to do it without having an image to use as a texture? I needed to asign a rgb color on it. But I guess I will only make 16 colors as jpg pics to add them as texture.
Nada por ahora

EgonOlsen

Quote from: "Melssj5"So, Its imposible to do it without having an image to use as a texture?
Exactly!

culli

Have you tried Object3D.setAdditionalColor?  It works well for me:


public Piece3D(Color color) {
       super(Primitives.getCylinder(10, 1, 0.5f));
       this.setAdditionalColor(color);
       build();
}

...
Piece3D singlePiece = new Piece3D(new Color(255, 255, 0));
...


I also use this for highlighting the pieces when the mouse pointer is over them.

If you want, I can send a screenshot to make sure we're talking about the same thing.

Melssj5

Yeah, that would be great. Please post the sshot.
Nada por ahora

culli

Here's a picture of my simple application:



As you can see, I'm making chinese checkers.  

When the mouse is over the pieces, they turn white.  If you click and drag the pieces, they'll move around the board.  They have no texture but the default Object3D texture assigned, plus the addtional color.  

Anyway, this seemed a good thing to start with because it has only a few rules, it has hex tiles which are good for war simulation games later, and I can do a bit of AI with it.  The model for the board has very few triangles and I'm still learning how to map the texture correctly, but it's not so important to me right now.  I'm more interested in the game play, what little there is.  I had a lot of the game logic done a while ago, now I'm finding problems with my hex tile representation.  I don't spend very much time on this, so it's going slowly.

Melssj5

Yeah, it worked but the color is too bright. I guess I will use this tecnique as secundary color and I will put some other textures by myself. Thanks a lot, was a useful advice. Bye.
Nada por ahora