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

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7280 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
sha..rd 2011-04-20 20:18:41 +00:00
parent 8019ba2a53
commit 7d6167c0dc
4 changed files with 19 additions and 0 deletions
engine/src
core/com/jme3
lwjgl-ogl/com/jme3/renderer/lwjgl

@ -59,6 +59,12 @@ public interface Renderer {
*/
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.
*

@ -62,6 +62,9 @@ public class NullRenderer implements Renderer {
return stats;
}
public void invalidateState(){
}
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() {
colorSet = false;

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