activate();
    public void render(Spatial spat, Texture tex) {      // clear the current states since we are renderering into a new location      // and can not rely on states still being set.      Spatial.clearCurrentStates();        try {            if (pbuffer.isBufferLost()) {                LoggingSystem.getLogger().log(Level.WARNING,                        "PBuffer contents lost - will recreate the buffer");                deactivate();                pbuffer.destroy();                initPbuffer();            }            if (useDirectRender) {              // setup and render directly to a 2d texture.                GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureId());                pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);                activate();                parentRenderer.clearBuffers();                spat.onDraw(parentRenderer);                deactivate();                pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);            } else {              // render and copy to a texture                activate();                parentRenderer.clearBuffers();                spat.onDraw(parentRenderer);                GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureId());                GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0,                        PBUFFER_WIDTH, PBUFFER_HEIGHT);                deactivate();            }            tex.setNeedsFilterRefresh(true);        } catch (Exception e) {            LoggingSystem.getLogger().throwing(this.getClass().toString(),                    "render(Spatial, Texture)", e);        }        // Clear the states again since we will be moving back to the old        // location and don't want the states bleeding over causing things        // *not* to be set when they should be.        Spatial.clearCurrentStates();    }