videoplayer , view image , on touch click need help

Started by Archer, May 22, 2014, 11:28:13 AM

Previous topic - Next topic

Archer

Hi

your library is very useful , i was search for way to show 3d model as there is no official implementation for it ,
now i have some question , hope to give me steps to start solve it

- how can show VideoView(xml)  or Mediaplayer (stream from youtube ) over target ?
- how can show image over target , as i can not see target as possible
- way to handle touch action over object only not all surfaceView

Thanks for your hard work

EgonOlsen

You can most likely do these things, but it's out of the scope of the engine. jPCT-AE is a 3d engine. It renders into any gl context that you provide. It doesn't provide its own context nor does it care about what else is going on onscreen or with touch events. It doesn't force you into any special code structure. Just provide a gl context that it can render into. Everything else is up to you.

Archer

i have done video , and image , but have issue on 3d integration with vuforia
your example about integration is working fine , but it was related to native Example of vuforia ,
i have done the same with java videoPlayBack Vuforia example , but have error in update 3d view regard to camera calibration

Here is my code for load 3d : at videoPlayBackrender.java constructor


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...:-)
com.threed.jpct.Texture texture = new com.threed.jpct.Texture(
BitmapHelper.rescale(BitmapHelper.convert(mActivity
.getResources().getDrawable(R.drawable.ic_launcher)),
64, 64));
TextureManager.getInstance().addTexture("texture", texture);
try {
cube = Object3D.mergeAll(Loader.load3DS(
mActivity.getAssets().open("skeleton.3DS"), 10.0f));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

// cube = Primitives.getCube(10);
// cube.calcTextureWrapSpherical();
cube.strip();
cube.build();

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


Here on RenderFrame() method i get modelViewMatrixKeyframe

for (int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++) {
// Get the trackable:
TrackableResult trackableResult = state.getTrackableResult(tIdx);

ImageTarget imageTarget = (ImageTarget) trackableResult
.getTrackable();
Log.d("archer", imageTarget.getName());
int currentTarget = 0;

// We store the modelview matrix to be used later by the tap

modelViewMatrix[currentTarget] = Tool
.convertPose2GLMatrix(trackableResult.getPose());
float[] modelViewMatrixKeyframe = Tool.convertPose2GLMatrix(
trackableResult.getPose()).getData();

and then update 3d

float x = modelViewMatrixKeyframe[12];
float y = modelViewMatrixKeyframe[13];
float z = modelViewMatrixKeyframe[14];

modelViewMatrixKeyframe[12] = 0;
modelViewMatrixKeyframe[13] = 0;
modelViewMatrixKeyframe[14] = 0;

CameraCalibration calibration = CameraDevice.getInstance()
.getCameraCalibration();
Vec2F size = calibration.getSize();
Vec2F focalLength = calibration.getFocalLength();
float fovyRadians = (float) (2 * Math.atan(0.5f
* size.getData()[1] / focalLength.getData()[1]));
float fovRadians = (float) (2 * Math.atan(0.5f
* size.getData()[0] / focalLength.getData()[0]));

cam.setFovAngle(fovRadians);
cam.setYFovAngle(fovyRadians);


result too bad , when gone away from target , 3d still appear but not moving , and when moving about target , 3d move slow and with bad resolution like 2d


Please tell what i should be aware to make update of 3d

Thanks for your reply