continues the removal of static references

This commit is contained in:
codeanticode
2014-01-20 12:14:35 -05:00
parent a8a15d112e
commit f2c730b58f
10 changed files with 262 additions and 202 deletions

View File

@@ -40,6 +40,7 @@ import java.nio.IntBuffer;
*/
public class FrameBuffer implements PConstants {
protected PGraphicsOpenGL pg;
protected PGL pgl;
protected int context; // The context that created this framebuffer.
@@ -67,16 +68,17 @@ public class FrameBuffer implements PConstants {
protected IntBuffer pixelBuffer;
FrameBuffer() {
pgl = PGraphicsOpenGL.pgPrimary.pgl;
FrameBuffer(PGraphicsOpenGL pg) {
this.pg = pg;
pgl = pg.pgl;
context = pgl.createEmptyContext();
}
FrameBuffer(int w, int h, int samples, int colorBuffers,
FrameBuffer(PGraphicsOpenGL pg, int w, int h, int samples, int colorBuffers,
int depthBits, int stencilBits, boolean packedDepthStencil,
boolean screen) {
this();
this(pg);
glFbo = 0;
glDepth = 0;
@@ -136,13 +138,13 @@ public class FrameBuffer implements PConstants {
}
FrameBuffer(int w, int h) {
this(w, h, 1, 1, 0, 0, false, false);
FrameBuffer(PGraphicsOpenGL pg, int w, int h) {
this(pg, w, h, 1, 1, 0, 0, false, false);
}
FrameBuffer(PGraphicsOpenGL pg, int w, int h, boolean screen) {
this(w, h, 1, 1, 0, 0, false, screen);
this(pg, w, h, 1, 1, 0, 0, false, screen);
}
@@ -201,7 +203,7 @@ public class FrameBuffer implements PConstants {
noDepth = true;
}
public void finish(PGraphicsOpenGL pg) {
public void finish() {
if (noDepth) {
// No need to clear depth buffer because depth testing was disabled.
if (pg.getHint(ENABLE_DEPTH_TEST)) {