1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

OpenGL and ModelView Matrix


Last Updated:

  1. mr87

    mr87 New Member This Topic's Starter

    Joined:
    Aug 2, 2010
    Messages:
    2
    Likes Received:
    0
    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

    Joined:
    Jul 26, 2010
    Messages:
    15
    Likes Received:
    3
    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 This Topic's Starter

    Joined:
    Aug 2, 2010
    Messages:
    2
    Likes Received:
    0
    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

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    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...