1
Support / I can texture any primitive except a plane. Why?
« on: December 08, 2010, 09:45:14 am »
Consider this bit o' code:
The sphere primitive takes the texture (as do all the other primitives) but the plane doesn't. Why?
Code: [Select]
import com.threed.jpct.*;
public class PrimitiveTests2 {
private World world;
private FrameBuffer buffer;
private Object3D floor, part;
public static void main(String[] args) throws Exception {
new PrimitiveTests2().loop();
}
public PrimitiveTests2() throws Exception {
world = new World();
world.setAmbientLight(0, 255, 0);
TextureManager.getInstance().addTexture("expo_bumps", new Texture("images/expo_bumps.png"));
floor = Primitives.getPlane(5, 1f);
floor.setTexture("expo_bumps");
floor.setEnvmapped(Object3D.ENVMAP_ENABLED);
floor.build();
world.addObject(floor);
part = Primitives.getSphere(10, 1f);
part.setTexture("expo_bumps");
part.setEnvmapped(Object3D.ENVMAP_ENABLED);
part.build();
world.addObject(part);
world.getCamera().setPosition(5, 5, -10);
world.getCamera().lookAt(SimpleVector.ORIGIN);
}
private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
while (!org.lwjgl.opengl.Display.isCloseRequested()) {
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
System.exit(0);
}
}
The sphere primitive takes the texture (as do all the other primitives) but the plane doesn't. Why?