* Added Renderer.invalidateState() to reset the render context

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7280 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 8019ba2a53
commit 7d6167c0dc
  1. 6
      engine/src/core/com/jme3/renderer/Renderer.java
  2. 3
      engine/src/core/com/jme3/system/NullRenderer.java
  3. 4
      engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
  4. 6
      engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -59,6 +59,12 @@ public interface Renderer {
*/ */
public Statistics getStatistics(); public Statistics getStatistics();
/**
* Invalidates the current rendering state. Should be called after
* the GL state was changed manually or through an external library.
*/
public void invalidateState();
/** /**
* Clears certain channels of the current bound framebuffer. * Clears certain channels of the current bound framebuffer.
* *

@ -62,6 +62,9 @@ public class NullRenderer implements Renderer {
return stats; return stats;
} }
public void invalidateState(){
}
public void clearBuffers(boolean color, boolean depth, boolean stencil) { public void clearBuffers(boolean color, boolean depth, boolean stencil) {
} }

@ -101,6 +101,10 @@ public class LwjglGL1Renderer implements GL1Renderer {
} }
} }
public void invalidateState(){
context.reset();
}
public void resetGLObjects() { public void resetGLObjects() {
colorSet = false; colorSet = false;

@ -407,6 +407,12 @@ public class LwjglRenderer implements Renderer {
logger.log(Level.INFO, "Caps: {0}", caps); logger.log(Level.INFO, "Caps: {0}", caps);
} }
public void invalidateState(){
context.reset();
boundShader = null;
lastFb = null;
}
public void resetGLObjects() { public void resetGLObjects() {
objManager.resetObjects(); objManager.resetObjects();
statistics.clearMemory(); statistics.clearMemory();

Loading…
Cancel
Save