That's it......
Thx!
Thx!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
import java.awt.Color;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
public class Template {
/**
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
Template.setupAndRun();
}
private static void setupAndRun() throws InterruptedException {
TextureManager tm = TextureManager.getInstance();
String texName = "tex3.jpg";
Texture tex = new Texture(texName);
tm.addTexture(texName, tex);
int texID = tm.getTextureID(texName);
Object3D obj1 = new Object3D(2);
obj1.addTriangle(V(100, -100, 0), 0f, 0f, V(100, 0, 0), 0f, 1f, V(-100, 0, 0), 1f, 1f, texID);
obj1.build();
obj1.setEnvmapped(Object3D.ENVMAP_ENABLED);
World world = new World();
world.addLight(new SimpleVector(0, -50, 130), Color.WHITE);
world.setAmbientLight(255, 255, 255);
world.getCamera().setPosition(0, 0, 250);
world.getCamera().lookAt(V(0, 0, 0));
world.addObject(obj1);
FrameBuffer 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.BLACK);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
System.exit(0);
}
public static SimpleVector V(float x, float y, float z) {
return new SimpleVector(x, y, z);
}
}
Texture red = new Texture(8,8, Color.RED);
TextureManager.getInstance().addTexture("red", red);
box = Primitives.getBox(10f, 1f);
box.setTexture("red");
box.setEnvmapped(Object3D.ENVMAP_ENABLED);
box.build();
Page created in 0.038 seconds with 12 queries.