Skip to content

Instantly share code, notes, and snippets.

@col
Created May 17, 2014 02:15
Show Gist options
  • Save col/a84ff1b7467c2acd76cc to your computer and use it in GitHub Desktop.
Save col/a84ff1b7467c2acd76cc to your computer and use it in GitHub Desktop.
Processing - 3D - OpenGL - Basic cube with rotation
import processing.opengl.*;
import controlP5.*;
ControlP5 MyController;
void setup()
{
size(400, 400, OPENGL);
MyController = new ControlP5(this);
MyController.addSlider("yRotation",0,6.28,20,20,20,200,10);
MyController.addSlider("xRotation",0,6.28,20,20,40,200,10);
MyController.addSlider("zRotation",0,6.28,20,20,60,200,10);
}
float yRotation = 0;
float xRotation = 0;
float zRotation = 0;
void draw()
{
background(10,100,150);
pushMatrix();
translate(200,200,0);
rotateY(yRotation);
rotateX(xRotation);
rotateZ(zRotation);
box(100);
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment