Created
May 17, 2014 02:15
-
-
Save col/a84ff1b7467c2acd76cc to your computer and use it in GitHub Desktop.
Processing - 3D - OpenGL - Basic cube with rotation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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