* 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

View File

@ -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.
* *

View File

@ -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) {
} }

View File

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

View File

@ -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();