Author Topic: [topic-1-1]how to use the jpct-ae matrix as well as the OPENGL ES 2.0  (Read 678 times)

Offline cefengxu

  • int
  • **
  • Posts: 65
    • View Profile
Dear Master :

Purpose :
i need to set a  [ real-time matrix ] for the obj to realize the AR ;

as the normally, i can use the "fucntion GLES20.glUniformMatrix4fv" to set a matrix to the shader , and then calculate the right position of the model on the screen;

i can get the translate matrix output by ARToolkit in real-time ;
 but  i do not know how to set the matrix when i use the jpct-ae to rendering.

i have tried to use the "jpct-ae-fucniton model.setTranslationMatrix(mat);" , but all the result  for scale , position and direction  are wrong.


question : how to use the translationmatrix in jpct as will as GLES20function::GLES20.glUniformMatrix4fv??
« Last Edit: October 27, 2015, 11:20:18 am by cefengxu »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net

Offline cefengxu

  • int
  • **
  • Posts: 65
    • View Profile
Re: how to use the jpct-ae matrix as well as the OPENGL ES 2.0
« Reply #2 on: October 27, 2015, 10:15:34 am »
i have fix this issue , i will post a tutorial later.

Question: and then , the model could not be change ( always be laid on the mark ,as shown as the attached ) even i use the function rotationMatirx ;

my code as belown:

Code: [Select]
    public void onDrawFrame(GL10 unused) {
float[] projection = ARNativeActivity.getProjectM();
Matrix projMatrix = new Matrix();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);

float[] transformation = ARNativeActivity.getTransformationM();
Matrix dump = new Matrix();
dump.setDump(transformation);
dump.transformToGL();
alita.clearTranslation();
alita.translate(dump.getTranslation());
alita.setRotationMatrix(dump);

alita.setState(stat);
alita.animate(ticks);
}