don't enable mipmapping if texture is the color buffer of a PGraphics

This commit is contained in:
codeanticode
2012-11-19 16:54:11 +00:00
parent 11ca3752fe
commit e02e3392c0
4 changed files with 32 additions and 2 deletions
@@ -5522,6 +5522,7 @@ public class PGraphicsOpenGL extends PGraphics {
sampling, mipmap);
texture = new Texture(parent, width, height, params);
texture.invertedY(true);
texture.colorBufferOf(this);
pgPrimary.setCache(this, texture);
}
}
@@ -5970,7 +5971,8 @@ public class PGraphicsOpenGL extends PGraphics {
protected void checkTexture(Texture tex) {
if (tex.usingMipmaps == hints[DISABLE_TEXTURE_MIPMAPS]) {
if (!tex.isColorBuffer() &&
tex.usingMipmaps == hints[DISABLE_TEXTURE_MIPMAPS]) {
if (hints[DISABLE_TEXTURE_MIPMAPS]) {
tex.usingMipmaps(false, textureSampling);
} else {
@@ -82,6 +82,7 @@ public class Texture implements PConstants {
protected PGraphicsOpenGL pg; // The main renderer
protected PGL pgl; // The interface between Processing and OpenGL.
protected PGL.Context context; // The context that created this texture.
protected PGraphicsOpenGL pgDraw; // The main renderer is the color buffer of.
protected boolean usingMipmaps;
protected boolean usingRepeat;
@@ -135,6 +136,8 @@ public class Texture implements PConstants {
pgl = pg.pgl;
context = pgl.createEmptyContext();
pgDraw = null;
glName = 0;
init(width, height, (Parameters)params);
@@ -1184,6 +1187,16 @@ public class Texture implements PConstants {
}
protected void colorBufferOf(PGraphicsOpenGL pgDraw) {
this.pgDraw = pgDraw;
}
protected boolean isColorBuffer() {
return pgDraw != null;
}
///////////////////////////////////////////////////////////
// Utilities.
@@ -5530,6 +5530,7 @@ public class PGraphicsOpenGL extends PGraphics {
sampling, mipmap);
texture = new Texture(parent, width, height, params);
texture.invertedY(true);
texture.colorBufferOf(this);
pgPrimary.setCache(this, texture);
}
}
@@ -5978,7 +5979,8 @@ public class PGraphicsOpenGL extends PGraphics {
protected void checkTexture(Texture tex) {
if (tex.usingMipmaps == hints[DISABLE_TEXTURE_MIPMAPS]) {
if (!tex.isColorBuffer() &&
tex.usingMipmaps == hints[DISABLE_TEXTURE_MIPMAPS]) {
if (hints[DISABLE_TEXTURE_MIPMAPS]) {
tex.usingMipmaps(false, textureSampling);
} else {
+13
View File
@@ -82,6 +82,7 @@ public class Texture implements PConstants {
protected PGraphicsOpenGL pg; // The main renderer
protected PGL pgl; // The interface between Processing and OpenGL.
protected PGL.Context context; // The context that created this texture.
protected PGraphicsOpenGL pgDraw; // The main renderer is the color buffer of.
protected boolean usingMipmaps;
protected boolean usingRepeat;
@@ -135,6 +136,8 @@ public class Texture implements PConstants {
pgl = pg.pgl;
context = pgl.createEmptyContext();
pgDraw = null;
glName = 0;
init(width, height, (Parameters)params);
@@ -1184,6 +1187,16 @@ public class Texture implements PConstants {
}
protected void colorBufferOf(PGraphicsOpenGL pgDraw) {
this.pgDraw = pgDraw;
}
protected boolean isColorBuffer() {
return pgDraw != null;
}
///////////////////////////////////////////////////////////
// Utilities.