Hi i'm making some App with QCAR & JPCT-AE. can SOMEONE see my source code & advice me? if you can, i'll send my source code to you. my email address is [email protected].
Please help me ^^
first
- i send modelViewMatrix(QCAR::Matrix44F) from JNI to JAVA ex) JNIEXPORT jfloatArray JNICALL Java_jp_may_com_VirtualButtonsRenderer_getNowMatrix(JNIEnv* env, jobject obj)
- use this modelViewMatrix like below
public class VirtualButtonsRenderer implements GLSurfaceView.Renderer {
public VirtualButtonsRenderer(Activity act) {
Config.maxAnimationSubSequences = 999;
// TODO Auto-generated constructor stub
this.act = act;
_Object3D = Loader.loadMD2(act.getResources().openRawResource(R.raw.tris), 1.0f);
_Object3D.setName("MyTarget");
}
public native float[] getNowMatrix();
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
initRendering();
QCAR.onSurfaceCreated();
world = new World();
world.setAmbientLight(20, 20, 20);
TextureManager tm = TextureManager.getInstance();
com.threed.jpct.Texture Cover = new com.threed.jpct.Texture(BitmapFactory.decodeStream(act.getResources().openRawResource(R.raw.skin)));
tm.addTexture("Cover", Cover);
_Object3D.setTexture("Cover");
world.addObject(_Object3D);
world.buildAllObjects();
sun = new Light(world);
sun.setIntensity(250, 250, 250);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 100);
cam.lookAt(_Object3D.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(_Object3D.getTransformedCenter());
sv.x -= 300;
sv.z -= 0;
sun.setPosition(sv);
MemoryHelper.compact();
}
public void onDrawFrame(GL10 gl) {
if (!mIsActive)
return;
if (renderFrame()) {
Matrix NowMatrix = new Matrix();
NowMatrix.fillDump(getNowMatrix());
world.getCamera().setBack(NowMatrix);
world.renderScene(fb);
world.draw(fb);
fb.display();
return;
} else {
mIsTouch = false;
}
}
}
here, i got problem. i thought Object3D can move like Teapot(QCAR Sample Object) on Marker with modelViewMatrix. but it couldn't.
this is my problem ^^;;
i would like to help you with your app, please send me your native imagetarget.cpp code,
before that i think you have seen this page ,refer this once
http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia
its project source code https://github.com/sidneibjunior/vuforia-jpct
fetch your modelViewMatrix from renderframe and send it to java , like this
const QCAR::TrackableResult* result = state.getTrackableResult(tIdx);
QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(result->getPose());
SampleUtils::rotatePoseMatrix(90.0f, 1.0f, 0, 0, &modelViewMatrix.data[0]);
//inversing the matrix QCAR::Matrix44F inverseMV = SampleMath::Matrix44FInverse(modelViewMatrix);
//transposing the inverted matrix QCAR::Matrix44F invTranspMV = SampleMath::Matrix44FTranspose(inverseMV);
send the inverse transpose matrix to java code. It will work fine... i hope :)