Update on what I've gleaned from spending more time reading:
The place where I want to be for rendering is
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame
within the else for OpenGL ES 2.0
Also to get my origin I need to grab the floats out of the Vec2f which ImageTarget's getSize returns as. Then I should be able to simply width/2, height/2.
That's all great. Where I'm still lost is all the OpenGL code. I've switched over from the teapot to some code that ksiva gave a person for displaying a 2d image.
http://ar.qualcomm.at/node/2000357
My end goal that I want to be able to do is simply do a glDrawArrays with a LINE_STRIP. I'll give the C++ code I have currently from Kim, and the Java code I have from another Android project to show where I'm wanting to get to.
C++ from Kim
QCAR::Vec2F targetSize = ((QCAR::ImageTarget *) trackable)->getSize();
QCAR::Matrix44F modelViewProjection;
SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale,
&modelViewMatrix.data[0]);
SampleUtils::scalePoseMatrix(targetSize.data[0], targetSize.data[1], 1.0f,
&modelViewMatrix.data[0]);
SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
&modelViewMatrix.data[0] ,
&modelViewProjection.data[0]);
glUseProgram(shaderProgramID);
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &planeVertices[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &planeNormals[0]);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &planeTexcoords[0]);
glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);
glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
(GLfloat*)&modelViewProjection.data[0] );
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT,
(const GLvoid*) &planeIndices[0]);
Java from me
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);// OpenGL docs.
// vertexBuffer was given an array of floats
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, // OpenGL docs
vertexBuffer);
gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, indices.length);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); // OpenGL docs
gl.glDisable(GL10.GL_CULL_FACE); // OpenGL docs
Also if someone could explain to me what planeVertices[] planeTexcoords[] planeNormals[] planeIndices[] do in her example in the link, that would also be very helpful. I believe I understand vertices and indices pretty well but the other two I don't know.
Actually, adding that script to an empty gameobject won't work. Adding it to the ARCamera does. Binding a material doesn't make a difference. I agree with you that it shouldn't make a difference where you attach the script. But it does. I don't know why.
Edit:
More on a unified coordinate system here:
http://ar.qualcomm.at/node/2001030