Advertisement
olamedia

mv rotate

Oct 2nd, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void glTest(GLAutoDrawable drawable) {
  2.         PMVMatrix m = new PMVMatrix(true);
  3.         m.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  4.         m.glLoadIdentity();
  5.         m.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  6.         m.glLoadIdentity();
  7.         m.glTranslatef(5, 6, 7);
  8.         m.glRotatef(50, 0, 1, 0);
  9.         m.glRotatef(30, 1, 0, 0);
  10.         m.update();
  11.  
  12.         GL2 gl = drawable.getGL().getGL2();
  13.         gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  14.         gl.glLoadIdentity();
  15.         gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  16.         gl.glLoadIdentity();
  17.         gl.glTranslatef(5, 6, 7);
  18.         gl.glRotatef(50, 0, 1, 0);
  19.         gl.glRotatef(30, 1, 0, 0);
  20.  
  21.         FloatBuffer pmv = m.glGetMvMatrixf();
  22.         FloatBuffer glmv = FloatBuffer.allocate(16);
  23.         gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, glmv);
  24.         for (int i = 0; i < 16; i++) {
  25.             System.out.println(pmv.get(i) + " == " + glmv.get(i));
  26.         }
  27.         System.exit(0);
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement