This content has been marked as final. Show 3 replies
hello troubled guy,
i've got a good news for you.
i've run your program and figured it out where the problem is...
there are basically two problems...
first, you didn't specify the viewing platform for the simple universe. just do it -
universe = new SimpleUniverse(canvas3D);
universe.getViewingPlatform().setNominalViewingTransform(); //this is the one you missed.
next the major problem lies in forgetting to specify the Influencing bound for the Ambient light source. Be very careful in this mistake..it is really common programming pitfalls. so correct them as -
AmbientLight light = new AmbientLight(WHITE);
light.setInfluencingBounds(new BoundingSphere()); //this is the line you'v missed
light.setColor(new Color3f(Color.yellow)); //you can specify the color as well. the default one is white
I'm sure now that your code must be working....
if it's still not working, do post your whole code..i'll definitely solve it..
so till then,
And ya do always use the Gourad shading instead of flat shading because the former gives very realistic shading....!
so replace above line ColoringAttributes colorA = new ColoringAttributes(new Color3f(Color.red), ColoringAttributes.SHADE_FLAT); with
this ColoringAttributes colorA = new ColoringAttributes(new Color3f(Color.red), ColoringAttributes.SHADE_GOURAUD);