We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello,
i am using the opengl renderer for a 3d project. i used the example "ControlP5controllerOnTop3D" to make it work properly, however the color of the sliders and checkboxes i have used do not show. i only have black boxes where the color notifications should be. does anyone know how i can fix this. i have no idea if my features are enabled or not because there are no indications that work even though everything is programed. i have no errors and everything works.
thanks in advance.
destro
here's a shell of the code, but it exhibits the problem and works with no errors:
import processing.opengl.*;
import wblut.processing.*;
import wblut.geom.*;
import wblut.core.*;
import wblut.math.*;
import wblut.hemesh.*;
import java.util.List;
import controlP5.*;
ControlP5 cp5;
CheckBox rotFunctions;
CheckBox rotAxis;
CheckBox rotExploded;
CheckBox optionFill;
CheckBox optionStroke;
CheckBox optionBKGD;
Textlabel rotationlabel;
Textlabel rotateYlabel;
Textlabel rotateXlabel;
Textlabel rotateZlabel;
Textlabel functionlabel;
Textlabel axislabel;
Textlabel explodedlabel;
Textlabel strokeFilllabel;
Textlabel backgroundlabel;
int zCoordSliderVal;
int greyscaleBG = 255;
FloatList xMouse;
FloatList yMouse;
WB_Render3D render;
boolean enableSINrotation = true;
boolean enableCOSrotation = false;
boolean enableTANrotation = false;
boolean enableYrotation = false;
boolean enableXrotation = false;
boolean enableZrotation = false;
boolean enableEXPYrotation = false;
boolean enableEXPXrotation = false;
boolean enableNoStroke = false;
boolean enableFill = true;
boolean enableStroke = true;
boolean enableNoFill = false;
boolean enableRGB = false;
boolean enableHSB = true;
boolean enableGrey = false;
void setup() {
size(600, 600, OPENGL);
smooth(8);
cp5 = new ControlP5(this);
controllerInterface();
xMouse = new FloatList();
yMouse = new FloatList();
render = new WB_Render3D(this);
// cp5.setAutoDraw(false);
//cp5.draw();
}
void controllerInterface() {
pushMatrix();
rotationlabel = new Textlabel(cp5, "ROTATIONS", 10, 80);
rotateYlabel = new Textlabel(cp5, "ROTATE-Y", 10, 95);
rotateXlabel = new Textlabel(cp5, "ROTATE-X", 10, 115);
rotateZlabel = new Textlabel(cp5, "ROTATE-Z", 10, 135);
functionlabel = new Textlabel(cp5, "TRIG", 72, 80);
axislabel = new Textlabel(cp5, "AXIS", 122, 80);
explodedlabel = new Textlabel(cp5, "EXPLODED", 172, 80);
strokeFilllabel = new Textlabel(cp5, "STROKE/FILL", 10, 175);
backgroundlabel = new Textlabel(cp5, "BACKGROUND", 10, 235);
cp5.addSlider("zCoordSliderVal")
.setPosition(75, 50)
.setSize(120, 20)
.setRange(-width, width)
.setValue(0);
cp5.getController("zCoordSliderVal").setCaptionLabel("Z-Coordinate");
cp5.getController("zCoordSliderVal").getCaptionLabel().align(ControlP5.LEFT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(-60).setPaddingY(-15);
rotFunctions = cp5.addCheckBox("rotFunctions")
.setPosition(75, 90)
.setSize(20, 20)
.setItemsPerRow(1)
.addItem("SIN", 1)
.addItem("COS", 2)
.addItem("TAN", 3);
rotAxis = cp5.addCheckBox("rotAxis")
.setPosition(125, 90)
.setSize(20, 20)
.setItemsPerRow(1)
.addItem("Y-ROT", 1)
.addItem("X-ROT", 2)
.addItem("Z-ROT", 3);
rotExploded = cp5.addCheckBox("rotExploded")
.setPosition(175, 90)
.setSize(20, 20)
.setItemsPerRow(1)
.addItem("Y-AXIS", 1)
.addItem("X-AXIS", 2);
optionFill = cp5.addCheckBox("optionFill")
.setPosition(75, 170)
.setSize(20, 20)
.setItemsPerRow(1)
.addItem("NO STROKE", 1)
.addItem("FILL", 2);
optionStroke = cp5.addCheckBox("optionStroke")
.setPosition(175, 170)
.setSize(20, 20)
.setItemsPerRow(1)
.addItem("STROKE", 1)
.addItem("NO FILL", 2);
optionBKGD = cp5.addCheckBox("optionBKGD")
.setPosition(75, 230)
.setSize(20, 20)
.setItemsPerRow(2)
.setSpacingColumn(80)
.addItem("RGB", 1)
.addItem("HSB", 2)
.addItem("GREYSCALE", 3);
cp5.addSlider("greyscaleBG")
.setPosition(75, 272)
.setSize(120, 20)
.setRange(0, 255)
.setCaptionLabel("")
.setValue(255);
popMatrix();
}
void controlEvent(ControlEvent theEvent) {
if (theEvent.isFrom(rotFunctions)) {
}
if (theEvent.isFrom(rotAxis)) {
}
if (theEvent.isFrom(rotExploded)) {
}
if (theEvent.isFrom(optionFill)) {
}
if (theEvent.isFrom(optionStroke)) {
}
if (theEvent.isFrom(optionBKGD)) {
}
}
void mouseDragged() {
xMouse.append(mouseX);
yMouse.append(mouseY);
}
void mouseReleased() {
xMouse.clear();
yMouse.clear();
}
void draw() {
hint(ENABLE_DEPTH_TEST);
pushMatrix();
background(255, 10);
colorMode(HSB, 360, 100, 100, 360);
rotationlabel.draw(this);
rotateYlabel.draw(this);
rotateXlabel.draw(this);
rotateZlabel.draw(this);
functionlabel.draw(this);
axislabel.draw(this);
explodedlabel.draw(this);
strokeFilllabel.draw(this);
backgroundlabel.draw(this);
directionalLight(255, 255, 255, 1, 1, -1);
directionalLight(127, 127, 127, -1, -1, 1);
for(int i = 0; i < xMouse.size(); i ++) {
strokeWeight(random(1, 50));
stroke(random(360), random(100), random(100), random(50, 200));
point(xMouse.get(i), yMouse.get(i));
}
popMatrix();
hint(DISABLE_DEPTH_TEST);
}
Comments
Hi, at the end of your draw routine, reset the lights with
noLights();
the colors of your controller should be back to normal.THANK YOU!