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

@@ -83,6 +83,7 @@ public class Texture implements PConstants {
public int glWidth;
public int glHeight;
protected PGraphicsOpenGL pg;
protected PGL pgl; // The interface between Processing and OpenGL.
protected int context; // The context that created this texture.
protected boolean colorBuffer; // true if it is the color attachment of
@@ -118,8 +119,9 @@ public class Texture implements PConstants {
// Constructors.
public Texture() {
pgl = PGraphicsOpenGL.pgPrimary.pgl;
public Texture(PGraphicsOpenGL pg) {
this.pg = pg;
pgl = pg.pgl;
context = pgl.createEmptyContext();
colorBuffer = false;
@@ -134,8 +136,8 @@ public class Texture implements PConstants {
* @param width int
* @param height int
*/
public Texture(int width, int height) {
this(width, height, new Parameters());
public Texture(PGraphicsOpenGL pg, int width, int height) {
this(pg, width, height, new Parameters());
}
@@ -146,8 +148,9 @@ public class Texture implements PConstants {
* @param height int
* @param params Parameters
*/
public Texture(int width, int height, Object params) {
pgl = PGraphicsOpenGL.pgPrimary.pgl;
public Texture(PGraphicsOpenGL pg, int width, int height, Object params) {
this.pg = pg;
pgl = pg.pgl;
context = pgl.createEmptyContext();
colorBuffer = false;
@@ -249,7 +252,7 @@ public class Texture implements PConstants {
dispose();
// Creating new texture with the appropriate size.
Texture tex = new Texture(wide, high, getParameters());
Texture tex = new Texture(pg, wide, high, getParameters());
// Copying the contents of this texture into tex.
tex.set(this);
@@ -511,7 +514,7 @@ public class Texture implements PConstants {
}
if (tempFbo == null) {
tempFbo = new FrameBuffer(glWidth, glHeight);
tempFbo = new FrameBuffer(pg, glWidth, glHeight);
}
// Attaching the texture to the color buffer of a FBO, binding the FBO and
@@ -1237,7 +1240,7 @@ public class Texture implements PConstants {
}
if (tempFbo == null) {
tempFbo = new FrameBuffer(glWidth, glHeight);
tempFbo = new FrameBuffer(pg, glWidth, glHeight);
}
// This texture is the color (destination) buffer of the FBO.
@@ -1277,7 +1280,7 @@ public class Texture implements PConstants {
int texWidth, int texHeight,
int x, int y, int w, int h, boolean scale) {
if (tempFbo == null) {
tempFbo = new FrameBuffer(glWidth, glHeight);
tempFbo = new FrameBuffer(pg, glWidth, glHeight);
}
// This texture is the color (destination) buffer of the FBO.