1. Check out our app, Forums for Android! Download and leave feedback here!

OpenGL and ModelView Matrix

Discussion in 'Application Development' started by mr87, Aug 2, 2010.

  1. mr87

    mr87 New Member
    Thread Starter
    5

    Aug 2, 2010
    2
    0
    5
    I need to find the ModelView matrix of a current 3d object. Every method I found uses C and those functions do not exist in Java. Anyone knows how to find it in Java for android.

    Thanks
     

    Advertisement

  2. Nil

    Nil Member
    16

    Jul 26, 2010
    15
    3
    16
    Student :|
    Idaho, USA
    You do it more or less the same way you'd do it in C, and those functions do exist in Java, but the device you're using has to support GL ES 1.1 (you can specify this as the minimum version in your manifest, or check for GL ES 1.1 support at runtime).

    Code (Text):
    1. // assuming somewhere along the lines there's a "GL11 gl" line or parameter
    2. float[] output = new float[16];
    3. gl.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, output, 0);
     
  3. mr87

    mr87 New Member
    Thread Starter
    5

    Aug 2, 2010
    2
    0
    5
    I was using GL10, but I now changed it to GL11 and called glGetFloatv(). but the array it returns only consists of zeros :(
     
  4. jonbonazza

    jonbonazza Well-Known Member
    163

    Jul 13, 2010
    1,934
    458
    163
    Male
    Do you have anything that is written to the ModelView Matrix? Without seeing code, it is going to be impossible to accurately troubleshoot your problem.

    The method that was posted above is correct. If it is returning 0's, then the MV matrix, at the point that the above code is executed, is empty.
     

Share This Page

Loading...