I tried new way, it doesn't work well but it results in different.
At first, I used onSurfaceChanged Like below,
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
if(fb!=null) fb.dispose();
fb = new FrameBuffer(width, height);
if(master==null) {
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
try {
//objKirby = loadModel(getAssets().open("kirby.3ds"), null, 1, LOAD_TYPE_3DS);
objKirby = loadModel(getAssets().open("kirby.obj"),getAssets().open("kirby.mtl"), 1f, LOAD_TYPE_OBJ);
Log.d("dd",video1.getExternalId()+",");
createPolygon(); // it's an function i wrote in first post
} catch (IOException e) {
Log.d("main", "fnfe");
}
world.addObject(objKirby);
world.addObject(myPolygon);
Camera cam = world.getCamera();
cam.setPosition(0, -2, 0);
cam.lookAt(SimpleVector.ORIGIN);
//cam.lookAt(objKirby.getTransformedCenter());
sun.setPosition(cam.getPosition());
MemoryHelper.compact();
if(master == null) {
Logger.log("Saving master Activity!");
master = MainActivity.this;
}
}
}
this result in red polygon(it is code used when I wrote first post, texture of polygon is same with last texture when used to draw 3d Object).
And, when I tried to just draw polygon, without 3D object,
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
if(fb!=null) fb.dispose();
fb = new FrameBuffer(width, height);
if(master==null) {
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
try {
//objKirby = loadModel(getAssets().open("kirby.3ds"), null, 1, LOAD_TYPE_3DS);
objKirby = loadModel(getAssets().open("kirby.obj"),getAssets().open("kirby.mtl"), 1f, LOAD_TYPE_OBJ);
Log.d("dd",video1.getExternalId()+",");
createPolygon();
} catch (IOException e) {
Log.d("main", "fnfe");
}
//world.addObject(objKirby); Don't draw 3D object
world.addObject(myPolygon);
Camera cam = world.getCamera();
cam.setPosition(0, -2, 0);
cam.lookAt(SimpleVector.ORIGIN);
//cam.lookAt(objKirby.getTransformedCenter());
sun.setPosition(cam.getPosition());
MemoryHelper.compact();
if(master == null) {
Logger.log("Saving master Activity!");
master = MainActivity.this;
}
}
}
Then, I can saw polygon with black color.
It is not same with last texture when used to draw 3d Object and also it is not the video.
Can this the clue of solve this problem??