hello all,
this is a simple OPENGL-code, it worked in 1.51, doesn't work anymore....
can anyone help?
Thank you!
Chrisir
- // imports ---------------------------------------------------
- //import processing.opengl.PGraphicsOpenGL;
- import javax.media.opengl.GL;
- import javax.media.opengl.glu.GLU;
- import javax.media.opengl.glu.GLUquadric;
- import com.sun.opengl.util.texture.Texture;
- import com.sun.opengl.util.texture.TextureIO;
- import peasy.PeasyCam; //peasy camera control
- // opengl
- import processing.opengl.*;
- /** PeasyCam **/
- import peasy.*;
- // Audio
- //import ddf.minim.*;
- // for export
- import superCAD.*;
- // global vars -----------------------------------------------
- // control behaviour parameters --------------------
- boolean testingForDebugging = false;
- int showingCubeData = 0;
- //
- boolean boolGl_Control = false; // Marble with opengl?
- boolean boolGl_Control_for_Boxes = false; // Boxes with opengl?
- // Camera Types
- boolean CameraMoving = false; // camera always ahead of Marble
- boolean CameraMoving2 = false; // good for movie (camera on a circle track)
- // Movie
- boolean boolMakeMovie = false; // saves a Movie
- boolean boolUseCheckeredFloor = true; // Floor Type
- // other vars ---------------------------------------------------
- // cube
- final int cubeSize = 49; // width, height and depth
- final int undefinedCube = -11;
- // GL stuff
- PGraphicsOpenGL pgl;
- GL gl;
- GLU glu;
- GLUquadric mysphere;
- GLUquadric myBox;
- Texture textureMarble;
- float marbleX=200;
- float marbleY=200;
- float marbleZ=-100;
- float r = 19; // Sized to fit the texture
- float rotateMarble = 0.39;
- float rotateMarbleSpeed = 0.02; // .196
- float MarbleRotateX=0.2;
- float MarbleRotateY=0.2;
- float MarbleRotateZ=0.2;
- void setup() {
- size(890, 660, OPENGL);
- // size(screenWidth, screenHeight, OPENGL );
- // noCursor();
- //cam.setMinimumDistance(40);
- //cam.setMaximumDistance(6550);
- // cam.lookAt( 70, 390, 0 );
- pgl = (PGraphicsOpenGL) g;
- gl = pgl.gl;
- glu = pgl.glu;
- mysphere = glu.gluNewQuadric();
- glu.gluQuadricDrawStyle(mysphere, glu.GLU_FILL);
- glu.gluQuadricNormals(mysphere, glu.GLU_NONE);
- glu.gluQuadricTexture(mysphere, true);
- myBox = glu.gluNewQuadric();
- glu.gluQuadricDrawStyle(myBox, glu.GLU_FILL);
- glu.gluQuadricNormals(myBox, glu.GLU_NONE);
- glu.gluQuadricTexture(myBox, true);
- try {
- textureMarble = TextureIO.newTexture(new
- File(dataPath("textures2.jpg")), true);
- }
- catch (IOException e) {
- println("failed to load picture - line 159. ++++++++++++++++++++++");
- javax.swing.JOptionPane.showMessageDialog(this, e);
- exit();
- }
- } // func
- void draw ( ) {
- background (0);
- PaintMarble () ;
- }
- void PaintMarble () {
- pgl.beginGL();
- gl.glPushMatrix();
- gl.glTranslatef( marbleX, marbleY, marbleZ);
- gl.glRotatef(degrees(rotateMarble), MarbleRotateX, MarbleRotateY, MarbleRotateZ);
- gl.glColor3f(1, 1, 1);
- textureMarble.enable();
- textureMarble.bind();
- //The Sphere
- glu.gluSphere(mysphere, r, 40, 40);
- textureMarble.disable();
- gl.glPopMatrix();
- pgl.endGL();
- if (rotateMarble < 360) {
- rotateMarble = rotateMarble + rotateMarbleSpeed;
- }
- else {
- rotateMarble = 0;
- }
- } // method