Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Maro

#1
Hi, in these days i started to looking for a good sdk to combine with Vuforia.
I think this one is pretty good so i started to use, but i've encountered some problem.
Can someone help me?

I followed step by step this helpful guide: http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia

But when I call the function updateCamera(), i have ever the same error:
This is my code:

  public ImageTargetsRenderer(ImageTargets activity){
    this.mActivity = activity;
    world = new World();
    world.setAmbientLight(20, 20, 20);

    sun = new Light(world);
    sun.setIntensity(250, 250, 250);

    // Create a texture out of the icon...:-)
    Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(mActivity.getResources().getDrawable(R.drawable.ic_launcher)), 64, 64));
    TextureManager.getInstance().addTexture("texture", texture);

    cube = Primitives.getCube(10);
    cube.calcTextureWrapSpherical();
    cube.setTexture("texture");
    cube.strip();
    cube.build();
    cube.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS|Object3D.COLLISION_CHECK_SELF);
cube.setCollisionOptimization(true);

    world.addObject(cube);

    cam = world.getCamera();
    //cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
    //cam.lookAt(cube.getTransformedCenter());

    SimpleVector sv = new SimpleVector();
    sv.set(cube.getTransformedCenter());
    sv.y -= 100;
    sv.z -= 100;
    sun.setPosition(sv);
    MemoryHelper.compact();

    }

    /** Native function for initializing the renderer. */
    public native void initRendering();

    /** Native function to update the renderer. */
    public native void updateRendering(int width, int height);

    /** Called when the surface is created or recreated. */
    public void onSurfaceCreated(GL10 gl, EGLConfig config)
    {
        DebugLog.LOGD("GLRenderer::onSurfaceCreated");

        // Call native function to initialize rendering:
        initRendering();

        // Call QCAR function to (re)initialize rendering after first use
        // or after OpenGL ES context was lost (e.g. after onPause/onResume):
        QCAR.onSurfaceCreated();
    }


    /** Called when the surface changed size. */
    public void onSurfaceChanged(GL10 gl, int width, int height)
    {
    DebugLog.LOGD("GLRenderer::onSurfaceChanged");

    // Call native function to update rendering when render surface
    // parameters have changed:
    updateRendering(width, height);

    // Call QCAR function to handle render surface size changes:
    QCAR.onSurfaceChanged(width, height);

    if (fb != null) {
    fb.dispose();
    }
    fb = new FrameBuffer(width, height);
    }


    /** The native render function. */
    public native void renderFrame();


    /** Called to draw the current frame. */
    public void onDrawFrame(GL10 gl)
    {
        if (!mIsActive)
            return;
       
        // Update render view (projection matrix and viewport) if needed:
        mActivity.updateRenderView();

        // Call our native function to render content
        renderFrame();
       
        updateCamera();
       
        world.renderScene(fb);
        world.draw(fb);
        fb.display();
       
    }
   
    public void updateModelviewMatrix(float mat[]) {
        modelViewMat = mat;
    }
   
    public void updateCamera() {
    Matrix m = new Matrix();
    m.setDump(modelViewMat);
        cam.setBack(m);
    }


and this is my logcat:

04-23 13:24:50.255: E/AndroidRuntime(13001): FATAL EXCEPTION: GLThread 14
04-23 13:24:50.255: E/AndroidRuntime(13001): java.lang.NullPointerException
04-23 13:24:50.255: E/AndroidRuntime(13001): at com.threed.jpct.Matrix.setDump(Matrix.java:955)
04-23 13:24:50.255: E/AndroidRuntime(13001): at com.example.vuforiajpctae.ImageTargetsRenderer.updateCamera(ImageTargetsRenderer.java:160)
04-23 13:24:50.255: E/AndroidRuntime(13001): at com.example.vuforiajpctae.ImageTargetsRenderer.onDrawFrame(ImageTargetsRenderer.java:146)
04-23 13:24:50.255: E/AndroidRuntime(13001): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1388)
04-23 13:24:50.255: E/AndroidRuntime(13001): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)


the problem is about the function setDump in updateCamera, but i don't know how to fix, i tryed everything...
Please, healp me!