标记的二维位置

2D Position of marker

你好,我正在使用 ARToolKit v6 渲染基于 nft jpg 图像的标记,它工作得很好但是.. 我需要在屏幕(视图)中获取标记的位置,然后添加自定义 textView 是否可能?如何根据 projectionMatrix 和 modelViewMatrix 获取标记的二维位置?

或者我可以绘制文本或图像而不是立方体吗?

代码

 @Override
public void draw() {
    super.draw();

    GLES20.glEnable(GLES20.GL_CULL_FACE);
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);
    GLES20.glFrontFace(GLES20.GL_CCW);


    boolean show = false;
    for (int trackableUID : trackableUIDs) {
        if (ARToolKit.getInstance().queryMarkerVisible(trackableUIDs.get(trackableUID))) {
            float[] projectionMatrix = ARToolKit.getInstance().getProjectionMatrix();
            float[] modelViewMatrix = ARToolKit.getInstance().queryMarkerTransformation(trackableUIDs.get(trackableUID));
            Log.i("INFOOOOO", projectionMatrix.toString());
            Log.i("INFOOOOO", modelViewMatrix.toString());
            cube.draw(projectionMatrix, modelViewMatrix);
            show = true;
        }
    }
}

@sturner 非常感谢,如果有人正在寻找解决方案,我发现下面的解决方案是代码

            final float[] projectionMatrix = ARToolKit.getInstance().getProjectionMatrix();
            final float[] modelViewMatrix = ARToolKit.getInstance().queryMarkerTransformation(trackableUIDs.get(trackableUID));

            if (view == null) {
                view = new int[4];
                view[0] = 0;
                view[1] = 0;
                view[2] = ARTrackingActivity.width;
                view[3] = ARTrackingActivity.height;
            }

            int i = GLU.gluProject(0, 0, 0, modelViewMatrix, 0, projectionMatrix, 0, view, 0, floats, 0);
            if (i == GLES20.GL_TRUE) {
               // draw the object in screen
            }