Skip to content

Commit

Permalink
enable layer FBO layer when no background is called, so there should be
Browse files Browse the repository at this point in the history
no need for surface hack.
  • Loading branch information
codeanticode committed Aug 13, 2015
1 parent 26a9ffb commit eeb9dec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 6 additions & 2 deletions core/src/processing/opengl/PGL.java
Expand Up @@ -80,7 +80,7 @@ public abstract class PGL {
* See the code and comments involving this constant in
* PGraphicsOpenGL.endDraw().
*/
protected static boolean SAVE_SURFACE_TO_PIXELS_HACK = true;
protected static boolean SAVE_SURFACE_TO_PIXELS_HACK = false;

/** Enables/disables mipmap use. */
protected static boolean MIPMAPS_ENABLED = true;
Expand Down Expand Up @@ -625,7 +625,7 @@ protected void beginDraw(boolean clear0) {


IntBuffer labelTex;
protected void endDraw(boolean clear0, int windowColor) {
protected void endDraw(boolean clear, int windowColor) {
if (fboLayerInUse) {
syncBackTexture();

Expand Down Expand Up @@ -705,6 +705,8 @@ protected void endDraw(boolean clear0, int windowColor) {
int temp = frontTex;
frontTex = backTex;
backTex = temp;
} else if (!clear && pg.parent.frameCount == 1) {
requestFBOLayer();
}
}

Expand Down Expand Up @@ -754,6 +756,8 @@ private void createFBOLayer() {
String ext = getString(EXTENSIONS);
float scale = pg.getPixelScale();

System.err.println("creating fbo layer");

if (-1 < ext.indexOf("texture_non_power_of_two")) {
fboWidth = (int)(scale * pg.width);
fboHeight = (int)(scale * pg.height);
Expand Down
14 changes: 3 additions & 11 deletions core/src/processing/opengl/PGraphicsOpenGL.java
Expand Up @@ -1999,26 +1999,18 @@ protected boolean pointBuffersContextIsOutdated() {

@Override
public void beginDraw() {
if (primaryGraphics) {
// if (initialized) {
// if (sized) pgl.reinitSurface();
// if (parent.canDraw()) pgl.requestDraw();
// } else {
// initPrimary();
// }
report("top beginDraw()");

if (primaryGraphics) {
if (!initialized) {
initPrimary();
}

setCurrentPG(this);
} else {
pgl.getGL(getPrimaryPGL());
getPrimaryPG().setCurrentPG(this);
}

report("top beginDraw()");

if (!checkGLThread()) {
return;
}
Expand Down Expand Up @@ -6879,7 +6871,7 @@ protected void beginOnscreenDraw() {


protected void endOnscreenDraw() {
pgl.endDraw(clearColorBuffer0, parent.sketchWindowColor());
pgl.endDraw(clearColorBuffer, parent.sketchWindowColor());
}


Expand Down

0 comments on commit eeb9dec

Please sign in to comment.