// create the sphere object
sphere = new Sphere("sphere", Vector3f.ZERO, 32, 32, 5f);
// create the materials for the sphere
// step 1
MaterialState materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(NO_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
// assign the material to the sphere
sphere.setRenderState(materialState);
// and update the geometry
sphere.updateRenderState();
information.add("diffuse reflection only; no ambient no specular");
materials.add(materialState);
// step 2
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(NO_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(LOW_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("diffuse and specular reflection; low shininess; no ambient");
materials.add(materialState);
// step 3
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(NO_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(HIGH_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("diffuse and specular reflection; high shininess; no ambient");
materials.add(materialState);
// step 4
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(NO_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(EMISSIVE_COLOR);
materialState.setEnabled(true);
information.add("diffuse reflection; emission; no ambient or specular reflection");
materials.add(materialState);
// step 5
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_GRAY_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("ambient (gray) and diffuse reflection; no specular");
materials.add(materialState);
// step 6
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_GRAY_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(LOW_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("ambient (gray), diffuse and specular reflection; low shininess");
materials.add(materialState);
// step 7
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_GRAY_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(HIGH_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("ambient (gray), diffuse and specular reflection; high shininess");
materials.add(materialState);
// step 8
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_GRAY_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(EMISSIVE_COLOR);
materialState.setEnabled(true);
information.add("ambient (gray) and diffuse reflection; emission; no specular");
materials.add(materialState);
// step 9
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_COLORED_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("colored ambient and diffuse reflection; no specular");
materials.add(materialState);
// step 10
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_COLORED_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(LOW_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("colored ambient, diffuse and specular reflection; low shininess");
materials.add(materialState);
// step 11
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_COLORED_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(SPECULAR_COLOR);
materialState.setShininess(HIGH_SHININESS);
materialState.setEmissive(NO_COLOR);
materialState.setEnabled(true);
information.add("colored ambient, diffuse and specular reflection; high shininess");
materials.add(materialState);
// step 12
materialState = display.getRenderer().createMaterialState();
materialState.setAmbient(AMBIENT_COLORED_COLOR);
materialState.setDiffuse(DIFFUSE_COLOR);
materialState.setSpecular(NO_COLOR);
materialState.setShininess(NO_SHININESS);
materialState.setEmissive(EMISSIVE_COLOR);
materialState.setEnabled(true);
information.add("colored ambient and diffuse reflection; emission; no specular");
materials.add(materialState);
// attach the sphere to the root node of our scenegraph