1. Download our Official Android App: Forums for Android!

Apps OpenGL and ModelView Matrix

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

  1. mr87

    mr87 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 2, 2010

    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 Newbie
    Rank:
    None
    Points:
    16
    Posts:
    15
    Joined:
    Jul 26, 2010

    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 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 2, 2010

    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 Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    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...