Help with controlP5
in
Contributed Library Questions
•
2 years ago
I am just starting to fool around in 3D and have been experimenting with controlP5 and can't figure out why this happens. The slider and peasyCam example of controlP5 works fine and nothing goes wrong, but when I copy exactly as they have it, the slider follows the 3D shape. This is kind of hard to explain, so you'll probably just have to run the code and see what I'm talking about. Any help would be nice, and if this has already been posted, then I am sorry, because I couldn't find it anywhere.
Thanks,
TheGamersHaven
[Moderator's note: Moved to Contributed Libraries Questions. Please, read the descriptions of the sections. Thanks]
- import peasy.*;
- import controlP5.*;
- import processing.opengl.*;
- int res;
- PeasyCam cam;
- ControlP5 controlP5;
- PMatrix3D currCameraMatrix;
- PGraphics3D g3;
- void setup() {
- size(800,600,OPENGL);
- frame.setResizable(true);
- cam = new PeasyCam(this,100);
- cam.setMinimumDistance(50);
- cam.setMaximumDistance(10000);
- g3 = (PGraphics3D)g;
- cam = new PeasyCam(this, 100);
- controlP5 = new ControlP5(this);
- controlP5.addSlider("slider",5,50,128,20,100,10,100);
- Slider s1 = (Slider)controlP5.controller("sliderTicks1");
- if (res == 0) {
- res = 5;
- }
- }
- void draw() {
- hint(ENABLE_DEPTH_TEST);
- rotateX(-.5);
- rotateY(-.5);
- rotateZ(-.5);
- background(150);
- noStroke();
- lights();
- fill(200);
- translate(0,0,0);
- sphereDetail(res);
- sphere(100);
- pushMatrix();
- translate(200,0,-50);
- box(30);
- popMatrix();
- hint(DISABLE_DEPTH_TEST);
- gui();
- }
- void gui() {
- currCameraMatrix = new PMatrix3D(g3.camera);
- camera();
- controlP5.draw();
- g3.camera = currCameraMatrix;
- }
- void slider(int tempRes) {
- res = tempRes;
- }
- /*void keyPressed() {
- if (key == ' ') {
- }
- }
- */
Thanks,
TheGamersHaven
[Moderator's note: Moved to Contributed Libraries Questions. Please, read the descriptions of the sections. Thanks]
1