Used the dipose method of native object to delete framebuffers and textures when the Fpp is cleaned up

git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@10980 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent db3f3c16d2
commit 912f560f6e
  1. 6
      jme3-core/src/main/java/com/jme3/post/Filter.java
  2. 11
      jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java

@ -192,10 +192,10 @@ public abstract class Filter implements Savable {
} }
public void cleanup(Renderer r) { public void cleanup(Renderer r) {
r.deleteFrameBuffer(renderFrameBuffer); renderFrameBuffer.dispose();
r.deleteImage(renderedTexture.getImage()); renderedTexture.getImage().dispose();
if(depthTexture!=null){ if(depthTexture!=null){
r.deleteImage(depthTexture.getImage()); depthTexture.getImage().dispose();
} }
} }
} }

@ -378,13 +378,14 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
viewPort.getCamera().setViewPort(left, right, bottom, top); viewPort.getCamera().setViewPort(left, right, bottom, top);
viewPort.setOutputFrameBuffer(outputBuffer); viewPort.setOutputFrameBuffer(outputBuffer);
viewPort = null; viewPort = null;
renderManager.getRenderer().deleteFrameBuffer(renderFrameBuffer);
renderFrameBuffer.dispose();
if(depthTexture!=null){ if(depthTexture!=null){
renderManager.getRenderer().deleteImage(depthTexture.getImage()); depthTexture.getImage().dispose();
} }
renderManager.getRenderer().deleteImage(filterTexture.getImage()); filterTexture.getImage().dispose();
if(renderFrameBufferMS != null){ if(renderFrameBufferMS != null){
renderManager.getRenderer().deleteFrameBuffer(renderFrameBufferMS); renderFrameBufferMS.dispose();
} }
for (Filter filter : filters) { for (Filter filter : filters) {
filter.cleanup(renderer); filter.cleanup(renderer);
@ -560,4 +561,4 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
viewPort.setOutputFrameBuffer(renderFrameBuffer); viewPort.setOutputFrameBuffer(renderFrameBuffer);
} }
} }
} }

Loading…
Cancel
Save