jPCT-AE - a 3d engine for Android > Support

primitives colour

(1/2) > >>

Mauri:
Hi everyone,
first post here with a problem that probably is incredibly daft, but as I have just started out with both JPCT and android coding  I hope I will not get told off too badly for my question  :)
I want to visualise a model which is made of cubes and cylinders (1000+ cubes usually and cylinders, well I am not sure how many of them yet).
I am using the primitives to do this and I have been able, so far, to visualise the cubes just fine. However, when I try to add a solid colour to the cubes all I get is  grey cubes (the grey shade changes according to the ambient light), but there is no trace of the colour I wanted for my objects. This is what I have done:

--- Code: --- public Object3D MakeCube(float size, float posX, float posY, float posZ, int red, int green, int blue) {

Object3D acube = Primitives.getCube(size);
RGBColor cubeColour= new RGBColor(red,green,blue);
acube.setAdditionalColor(cubeColour);
acube.rotateY(-(float) Math.PI/4f);
acube.rotateMesh();
acube.translate(posX, posY, posZ);
acube.translateMesh();
acube.strip();     
acube.build();

return(acube);
}

--- End code ---

Where am I going wrong? thanks in advance for the replies.
Cheers.

EgonOlsen:
What happens if you set the ambient color to (0,0,0)? Which values are you using when calling MakeCube?

Mauri:
Thanks for your reply. This is the code I have and I tried ambient light from (0,0,0) , which made my cubes very dark grey to 250,250,250 which made them almost white

--- Code: --- world = new World();
world.setAmbientLight(0, 0, 0);

sun = new Light(world);
sun.setIntensity(250, 250, 250);
--- End code ---
the colour I have for the cubes at the moment is red=241 green =90 blue=43

EgonOlsen:
No idea...which renderer are you using? OpenGL ES 1.1 or 2.0? If you set ambient to white (or almost), everything will be white no matter which additional color has been set, but if set to 0,0,0, the additional color should be fully visible. Could you try a getAdditionalColor() on one of the cubes and check that the returned values are actually correct!?

Mauri:
Thanks again for your time.
The values returned by getAdditionalColor() are the correct ones for all cubes.
I am using OpenGL ES 1.1
Cheers

Navigation

[0] Message Index

[#] Next page

Go to full version