how to set frame buffer in GLES20 in vuforia

Started by nima.sh23, February 12, 2015, 01:35:58 PM

Previous topic - Next topic

nima.sh23

Hi
i want set a jpct frame buffer in GLES20 in vuforia for show my 3d object in camera.
how can i do that?
      if (!mActivity.isExtendedTrackingActive())
            {
               TextureManager tm = TextureManager.getInstance();
               if(!tm.containsTexture("texture"))
               {
               com.threed.jpct.Texture texture = new com.threed.jpct.Texture(BitmapHelper.rescale(BitmapHelper
              .convert(mActivity.getResources().getDrawable(R.drawable.camaro)), 64, 64));
            TextureManager.getInstance().addTexture("texture", texture);
               }
                   InputStream objStream=null ;
                   InputStream mtlStream=null ;
                   World world = new World();
           world.setAmbientLight(20, 20, 20);
           Light sun = new Light(world);
           sun.setIntensity(250, 250, 250);
               try {
            objStream = mActivity.getResources()
    .getAssets().open("camaro_obj");
            mtlStream = mActivity.getResources()
    .getAssets().open("camaro_mtl");
               } catch (IOException e) {

e.printStackTrace();
}
        Object3D cube = Object3D.mergeAll(Loader.loadOBJ(objStream, mtlStream, 10));
cube.setTexture("texture");
cube.strip();
cube.build();
Camera cam = world.getCamera();
        cam.moveCamera(Camera.CAMERA_MOVEOUT, 10);
        cam.lookAt(cube.getTransformedCenter());
        world.addObject(cube);
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();
com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
mResult.setDump(modelViewMatrix);
cube.setRotationMatrix(mResult); 
cam.setBack(mResult);
                world.renderScene(fb);
                world.draw(fb);
                fb.display();


help me please....!!

EgonOlsen

What do you mean exactly. I've acutually no idea about Vuforia, but i think that it creates the GL context for itself. You have to make it create an GLES2.0 context and then create a jPCT FrameBuffer instance in GLES2.0 mode.

nima.sh23

Thanks for your answer.
do you have a article for "use jpct in vuforia for android"?
help me please i need that.
thanks

EgonOlsen

There's the wiki: http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia. It doesn't cover the latest (Java based) version of Vuforia, but the basic ideas should be the same.

nima.sh23

Thanks a lot.
I make a project with vuforia and jpct.
but have a question..!!!
i change my dataset in ImageTargets.cpp,but my project dosent build,I know i should use of Cygwin for compile,i install Cygwin,but i dont know how can i setting up on my project.
can you help me,please?
thanks
Nima.S-H

EgonOlsen

No idea from my side...never used this, never tried to...maybe somebody else knows?