www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: sergey on September 17, 2010, 11:16:17 pm
-
I try create a triangle
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
TextureManager.getInstance().flush();
world = new World();
Resources res = getResources();
TextureManager tm = TextureManager.getInstance();
Texture grass_f = new Texture(res.openRawResource(R.raw.grass));
font = new Texture(res.openRawResource(R.raw.numbers));
tm.addTexture("grass", grass_f);
s1.set(0.0f, 0.0f, 120.0f);
s2.set(120.0f, 0.0f, 120.0f);
s3.set(120.0f, 0.0f, 0.0f);
//box2 = new Object3d(2);
box2.addTriangle(s1, 0, 1, s2, 1, 1, s3, 1, 0, tm.getTextureID("grass"));
s2.set(0, 0, 0);
box2.addTriangle(s3, 1, 0, s2, 0, 0, s1, 0, 1, tm.getTextureID("grass"));
box2.setName("box2");
world.addObject(box2);
world.buildAllObjects();
sun = new Light(world);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEUP, 20);
cam.lookAt(box2.getTransformedCenter());
cam.setFOV(1.5f);
sun.setIntensity(250, 250, 250);
SimpleVector sv = new SimpleVector();
sv.set(box2.getTransformedCenter());
sv.y -= 300;
sv.x -= 100;
sv.z += 200;
sun.setPosition(sv);
}
It's not working for me :(
-
Ensure that your triangle is defined counter clockwise or otherwise it will be culled away. Also make sure that your camera is at a position where you can actually see the triangle and not located inside the triangle for example.