ControlP5 slider issue

edited June 2015 in Library Questions

Hello,

I am trying to figure out a way to combine the HE Mesh Library with ControlP5 so that I can use the sliders to drive changes in the Meshes. I have run into an issue at the first hurdle though and can't seem to get the slider to 'slide'. If anyone could help then that would be great. The code is as follows:

import wblut.math.*;
import wblut.processing.*;
import wblut.core.*;
import wblut.hemesh.*;
import wblut.geom.*;
import controlP5.*;
ControlP5 cp5;

HE_Mesh mesh;
WB_Render render;

void setup() {
  size(800, 800, OPENGL);
  smooth(8);

  cp5 = new ControlP5(this);
  cp5.addSlider("sliderValue")
    .setRange(0, 100)
      .setValue(50)
        .setPosition(100, 200)
          .setSize(100, 10)
            ;

  HEC_Geodesic creator=new HEC_Geodesic();
  creator.setRadius(200); //set to slider value
  creator.setB(4);
  creator.setC(1);
  creator.setType(HEC_Geodesic.ICOSAHEDRON);
  mesh=new HE_Mesh(creator); 
  HET_Diagnosis.validate(mesh);
  render=new WB_Render(this);
}

void draw() {
  background(255);
  lights();
  translate(400, 400, 100);
  pushMatrix();
  rotateY(mouseX*1.0f/width*TWO_PI);
  rotateX(mouseY*1.0f/height*TWO_PI);
  stroke(0);
  render.drawEdges(mesh);
  noStroke();
  render.drawFaces(mesh);
  popMatrix();
}
Sign In or Register to comment.