I want to make the special effect like that:
What i do:
1, Render skeleton animation, assume the frame sequences are 1\2\3\4\5\6...
2, When rendering frame-1, first render to frameBuffer, then change the transparency of obj3d, render frame-1 to a texture.
3, When rendering frame-2, first render to frameBuffer, then blit the last render-target-texture(frame-1). So there are 2 obj3ds in frameBuffer now, one is frame-1 with transparency, one is frame-2. then change the transparency of obj3d, render frame-2 to a texture.
4, Goto step 3.
Problem:
When blitting, i got an black-screen. OpenglES 2.0, Code:
//onDrawFrame
frameBuffer.clear();
world.renderScene(frameBuffer);
world.draw(frameBuffer);
if(mTexture == null){
mTexture = new Texture(frameBuffer.getWidth(), frameBuffer.getHeight(), 100);
Log.d(D.TAG, "texture width: " + mTexture.getWidth());
Log.d(D.TAG, "texture height: " + mTexture.getHeight());
}
else {
frameBuffer.blit(mTexture, 0, 0, 0, 0, frameBuffer.getWidth(), frameBuffer.getHeight(), FrameBuffer.TRANSPARENT_BLITTING);
}
obj.setTransparency(100); // Adjust Config, so transparency value is between 0 - 255;
frameBuffer.setRenderTarget(mTexture);
world.draw(frameBuffer);
frameBuffer.removeRenderTarget();
obj.setTransparency(-1);