added PShape.setTexture(), PShape.setTextureMode()

This commit is contained in:
codeanticode
2012-12-31 00:40:47 +00:00
parent 4b51e9c4c0
commit 57f3797bb8
2 changed files with 56 additions and 23 deletions

View File

@@ -184,7 +184,6 @@ public class PShapeOpenGL extends PShape {
// Modes inherited from renderer
protected int textureMode;
protected int rectMode;
protected int ellipseMode;
protected int shapeMode;
@@ -725,7 +724,13 @@ public class PShapeOpenGL extends PShape {
// Drawing methods
public void textureMode(int mode) {
@Override
public void setTextureMode(int mode) {
if (openShape) {
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTextureMode()");
return;
}
if (family == GROUP) {
for (int i = 0; i < childCount; i++) {
PShapeOpenGL child = (PShapeOpenGL) children[i];
@@ -738,7 +743,12 @@ public class PShapeOpenGL extends PShape {
@Override
public void texture(PImage tex) {
public void setTexture(PImage tex) {
if (openShape) {
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTexture()");
return;
}
if (family == GROUP) {
for (int i = 0; i < childCount; i++) {
PShapeOpenGL child = (PShapeOpenGL) children[i];
@@ -760,26 +770,6 @@ public class PShapeOpenGL extends PShape {
}
@Override
public void noTexture() {
if (family == GROUP) {
for (int i = 0; i < childCount; i++) {
PShapeOpenGL child = (PShapeOpenGL) children[i];
child.noTexture();
}
} else {
PImage tex0 = image;
image = null;
if (tex0 != null && parent != null) {
((PShapeOpenGL)parent).removeTexture(tex0);
if (is2D()) {
((PShapeOpenGL)parent).strokedTexture(false);
}
}
}
}
protected void addTexture(PImage tex) {
if (textures == null) {
textures = new HashSet<PImage>();