How do I change the teapot with a text content in Vuforia's Image Target example?
The example is available at : https://developer.vuforia.com/resources/sample-apps/image-targets-sample-app
How do I change the teapot with a text content in Vuforia's Image Target example?
The example is available at : https://developer.vuforia.com/resources/sample-apps/image-targets-sample-app
I tried to access the links mbrenon gave. Unfortunately they didn't load.
My solution:
The reason why you have a Teapot is because Vuforia is using that class as the image to be shown. In order to have a plane text, I created my own PlaneTextClass.
Go to src->main->java->com.qualcomm.vuforia.samples->SampleApplication->utils. There you could find the objects you can use.
Add a class named "TextPlane" and extended from "MeshObject"
public class TextPlane extends MeshObject { private final static double planeVertices[] = { -50f, -50f, 0.0f, 50f, -50f, 0.0f, 50f, 50f, 0.0f, -50f, 50f, 0.0f }; private final static double planeTexcoords[] = { 0, 0, 1, 0, 1, 1, 0, 1 }; private final static double planeNormals[] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 }; private final static short planeIndices[] = { 0, 1, 2, 0, 2, 3 }; private Buffer mVertBuff; private Buffer mTexCoordBuff; private Buffer mNormBuff; private Buffer mIndBuff; public TextPlane(){ mVertBuff = fillBuffer(planeVertices); mTexCoordBuff = fillBuffer(planeTexcoords); mNormBuff = fillBuffer(planeNormals); mIndBuff = fillBuffer(planeIndices); } @Override public Buffer getBuffer(BUFFER_TYPE bufferType) { Buffer result = null; switch (bufferType) { case BUFFER_TYPE_VERTEX: result = mVertBuff; break; case BUFFER_TYPE_TEXTURE_COORD: result = mTexCoordBuff; break; case BUFFER_TYPE_INDICES: result = mIndBuff; break; case BUFFER_TYPE_NORMALS: result = mNormBuff; default: break; } return result; } @Override public int getNumObjectVertex() { return planeVertices.length / 3; } @Override public int getNumObjectIndex() { return planeIndices.length; }}
If you want to change the size of the image, change the values in PlaneVertices[].
Go to src->main->java->com.qualcomm.vuforia.samples->VuforiaSamples->app->ImageTargets->ImageTargetRenderer.java
Add your new class in ImageTargetRenderer.java:
private TextPlane mTextPlane;
mTextPlane = new TextPlane();
Replace this:
GLES20.glVertexAttribPointer(vertexHandle, 3, GLES20.GL_FLOAT, false, 0, mTeapot.getVertices()); GLES20.glVertexAttribPointer(normalHandle, 3,