cleaning up PGL

This commit is contained in:
codeanticode
2014-11-15 23:04:32 -07:00
parent 9a44cb85e3
commit e85237a626
4 changed files with 92 additions and 66 deletions

View File

@@ -221,6 +221,7 @@ public class PJOGL extends PGL {
}
/*
@Override
public Canvas getCanvas() {
return canvas;
@@ -242,11 +243,12 @@ public class PJOGL extends PGL {
setFps = true;
}
}
*/
/*
@Override
protected void initSurface(int antialias) {
/*
if (profile == null) {
if (PROFILE == 2) {
try {
@@ -377,15 +379,16 @@ public class PJOGL extends PGL {
pg.parent.defaultSize = false;
registerListeners();
*/
fboLayerCreated = false;
fboLayerInUse = false;
firstFrame = true;
setFps = false;
}
*/
/*
@Override
protected void reinitSurface() {
sinkFBO = backFBO = frontFBO = null;
@@ -394,10 +397,10 @@ public class PJOGL extends PGL {
firstFrame = true;
pg.parent.defaultSize = false;
}
*/
@Override
protected void registerListeners() {
// @Override
// protected void registerListeners() {
// if (WINDOW_TOOLKIT == AWT) {
// pg.parent.addListeners(canvasAWT);
//
@@ -422,11 +425,11 @@ public class PJOGL extends PGL {
// if (canvas != null) {
// canvas.setFocusTraversalKeysEnabled(false);
// }
}
// }
@Override
protected void deleteSurface() {
// @Override
// protected void deleteSurface() {
// super.deleteSurface();
//
// if (canvasAWT != null) {
@@ -435,9 +438,9 @@ public class PJOGL extends PGL {
// } else if (canvasNEWT != null) {
// windowNEWT.removeGLEventListener(listener);
// }
}
// }
/*
@Override
protected int getReadFramebuffer() {
if (fboLayerInUse) {
@@ -637,7 +640,7 @@ public class PJOGL extends PGL {
}
}
}
*/
@Override
protected void getGL(PGL pgl) {
@@ -675,6 +678,8 @@ public class PJOGL extends PGL {
}
/*
@Override
protected boolean canDraw() {
return true;
@@ -689,7 +694,7 @@ public class PJOGL extends PGL {
@Override
protected void requestDraw() {
/*
drawException = null;
boolean canDraw = pg.parent.canDraw();
if (pg.initialized && (canDraw || prevCanDraw)) {
@@ -718,18 +723,18 @@ public class PJOGL extends PGL {
throw new RuntimeException(drawException);
}
}
*/
}
@Override
protected void swapBuffers() {
// if (WINDOW_TOOLKIT == AWT) {
// canvasAWT.swapBuffers();
// } else if (WINDOW_TOOLKIT == NEWT) {
// windowNEWT.swapBuffers();
// }
if (WINDOW_TOOLKIT == AWT) {
canvasAWT.swapBuffers();
} else if (WINDOW_TOOLKIT == NEWT) {
windowNEWT.swapBuffers();
}
}
*/
@Override
@@ -861,6 +866,20 @@ public class PJOGL extends PGL {
}
}
protected void init(GLAutoDrawable glDrawable) {
capabilities = glDrawable.getChosenGLCapabilities();
if (!hasFBOs()) {
throw new RuntimeException(MISSING_FBO_ERROR);
}
if (!hasShaders()) {
throw new RuntimeException(MISSING_GLSL_ERROR);
}
if (USE_JOGL_FBOLAYER && capabilities.isFBO()) {
int maxs = maxSamples();
numSamples = PApplet.min(capabilities.getNumSamples(), maxs);
}
}
protected class PGLListener implements GLEventListener {
public PGLListener() {}