Community

Topic: Android SDK

to change the video or 3d for my own marker (SOLVED)

Reza
Sunday, November 12, 2017

hi support team
i was wondering if you could help me with the problem right now i am facing . the problem is that when i have a maker scanned, your application as a default shows the same video in your sample application which i checked and downloaded. i need to upload my own marker to my database in your web site and when with app i scan that marker, i want the app to show my special video or 3d NOT the same default form in your sample. is it possible in this app or i must buy the full version of that app with license?
could you give me a hand here?
best

user profile image
Support Team  (expert)
Monday, November 13, 2017

Hi,
if you are using the rendering provided with the tutorial you can modify the ARRenderer class by defining in the onSurfaceCreated method new meshes based on the videos or 3d you need, as it done with the default videoMesh, for example:

...

private VideoMesh yourCustomVideoMesh = null;
...

public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
...
yourCustomVideoMesh = new VideoMesh((Activity)context);
yourCustomVideoMesh.InitMesh(context.getAssets(), "media/your_video.mp4", "media/your_keyframe.png", 0, false, null);
...
}
Once you have defined the mesh, you can modify the onDrawFrame method by checking the current marker id (the marker id is the one provided in the marker creation reserved area) in this way:
//default marker

if(currentMarker.getId().compareTo("3_522")==0){
float[] mvMatrix = new float[16];
float[] pMatrix = new float[16];
if (computeModelViewProjectionMatrix(mvMatrix, pMatrix)) {
videoMesh.DrawMesh(mvMatrix, pMatrix);
RenderUtils.checkGLError("completed video mesh Render");
}
}
//your custom marker
else if (currentMarker.getId().compareTo("your_marker_id") == 0) {
float[] mvMatrix = new float[16];
float[] pMatrix = new float[16];
if (computeModelViewProjectionMatrix(mvMatrix, pMatrix)) {
yourCustomVideoMesh.DrawMesh(mvMatrix, pMatrix);
RenderUtils.checkGLError("completed video mesh Render");
}
}
Anyway the rendering provided with the tutorial is just an example of a possible rendering that can be used.
Best,

Sign in to add a comment