1. Hot New Devices! HTC One M9 | Samsung Galaxy S6 | LG G4

OpenGL and ModelView Matrix


  1. mr87

    mr87 New Member

    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

    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

    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

    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