[topic-1-1]how to use the jpct-ae matrix as well as the OPENGL ES 2.0

Started by cefengxu, October 23, 2015, 10:39:30 AM

Previous topic - Next topic

cefengxu

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??


cefengxu

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:


    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);
}