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.


Messages - angelala

Pages: [1]
1
Programming / Re: Gif in vuforia-jpct-ae
« on: October 30, 2013, 08:14:47 PM »
Hi,  I had change my code to this:
GIFHandlerJPCTAE.addTexture( "Bottom", activity.getResources().openRawResource( R.raw.twobuf ), true );
and no error. But after i installed it into my phone, the app close unexpectedly.
Why is this happen?

Thanks.

2
Programming / Re: Gif in vuforia-jpct-ae
« on: October 29, 2013, 11:07:02 PM »
Below is my code in ImageTargetsRenderer.java, but I have an error :- The method getResources() is undefined for the type ImageTargetsRenderer


Code: [Select]
public ImageTargetsRenderer(ImageTargets activity){
        this.mActivity = activity;
        TextureManager.getInstance().flush();
        world = new World();
world.setAmbientLight(20, 20, 20);

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

// Create a red texture, for debugging purposes (TODO: remove)
Texture texture = new Texture( 8, 8, new RGBColor( 255, 0, 0) );
TextureManager.getInstance().addTexture( "texture", texture );

// Load some animated GIF files to use:
GIFHandlerJPCTAE.addTexture( "Front", getResources().openRawResource( R.raw.twobuf ), true );

plane = Primitives.getPlane(20, 30);
plane.calcTextureWrapSpherical();
plane.setTexture("texture");
plane.strip();
cube.build();

world.addObject(plane);

/* cube = Primitives.getCube(100);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();

world.addObject(cube);*/

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

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

    }

    /** 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();
        initNativeCallback();

        // 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();
       
        long currentTimeMillis = System.currentTimeMillis();

if( currentTimeMillis - time >= 1000 )
{
Logger.log( fps + "fps" );
fps = 0;
time = System.currentTimeMillis();
}
fps++;
        // Animate the GIFs:
        animateGIFs( currentTimeMillis );
    }
   
 // Animate the GIFs
    private void animateGIFs( long currentTimeMillis )
    {
        // If a frame number has changed, update the UV coordinates.
        if( frontGIF.getCurrentFrameNumber() != frontGIF.animate( currentTimeMillis ) );
    }
   
    public void updateCamera() {
    Matrix m = new Matrix();
    m.setDump(modelViewMat);
            cam.setBack(m);
    }
   
    public void updateModelviewMatrix(float mat[]) {
        modelViewMat = mat;
    }

3
Programming / Gif in vuforia-jpct-ae
« on: October 29, 2013, 08:56:54 PM »
Hi, I had read this: http://www.paulscode.com/forum/index.php?topic=9.0 , this is awesome. Can this be implement into AR world. I want to render a gif on a plane on a marker.

Pages: [1]