sojamo / controlp5

A gui library for processing.org
GNU Lesser General Public License v2.1
490 stars 142 forks source link

turn off lights on controller. #101

Closed bizkitj closed 7 years ago

bizkitj commented 7 years ago

Is there anyway we can "turn off" the lights effect on controller?

/**
 * ControlP5 with PeasyCam support. tested with peasy 0.8.2
 *
 * by jeffg 2011
 */

import peasy.*;
import controlP5.*;
import processing.opengl.*;

PeasyCam cam;
ControlP5 cp5;

int buttonValue = 1;

int myColor = color(255, 0, 0);

void setup() {
  size(400, 400, P3D);
  cam = new PeasyCam(this, 100);
  cp5 = new ControlP5(this);
  cp5.addButton("button", 10, 100, 60, 80, 20).setId(1);
  cp5.addButton("buttonValue", 4, 100, 90, 80, 20).setId(2);
  cp5.setAutoDraw(false);
}
void draw() {

  background(0);
  lights();
  fill(myColor);
  box(30);
  pushMatrix();
  translate(0, 0, 20);
  fill(150);
  box(5);
  popMatrix();
  // makes the gui stay on top of elements
  // drawn before.

  gui();

}

void gui() {
  hint(DISABLE_DEPTH_TEST);
  cam.beginHUD();
  cp5.draw();
  cam.endHUD();
  hint(ENABLE_DEPTH_TEST);
}

void controlEvent(ControlEvent theEvent) {
  println(theEvent.getController().getId());
}

void button(float theValue) {
  myColor = color(random(255), random(255), random(255));
  println("a button event. "+theValue);
}
sojamo commented 7 years ago

Have you tried noLights(); before drawing the gui.

bizkitj commented 7 years ago

:-),err, I am stupid. forgot this.

sojamo commented 7 years ago

ok, you wanna close this issue then?

bizkitj commented 7 years ago

Thank you sojamo.