将JPCT-AE与Vuforia集成

时间:2013-04-12 08:45:12

标签: android rendering vuforia jpct

我将JPCT-AE与Vuforia整合为Vuforia样本ImageTarget茶壶模型。我跟随了凯尔玛和Sam Rad的answer,现在我能够渲染我的模型和茶壶,但只能在横向模式下。

::::: BUT :::::::

当我在ImageTarget中的initApplication()进行更改

int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR; 
                                        or  ORIENTATION_PORTRATE;

我的模型在屏幕上开始渲染,这意味着它不是茶壶渲染的方式。据我了解,我们需要更改矩阵,以纵向模式渲染模型。

但我不知道怎么做。如果您有任何想法,请尽快转介我。

1 个答案:

答案 0 :(得分:0)

这是来自Vuforia示例代码的引用:

Set the screen orientation
        //
        // NOTE: It is recommended to set this because of the following reasons:
        //
        //    1.) Before Android 2.2 there is no reliable way to query the
        //        absolute screen orientation from an activity, therefore using 
        //        an undefined orientation is not recommended. Screen 
        //        orientation matching orientation sensor measurements is also
        //        not recommended as every screen orientation change triggers
        //        deinitialization / (re)initialization steps in internal QCAR 
        //        SDK components resulting in unnecessary overhead during 
        //        application run-time.
        //
        //    2.) Android camera drivers seem to always deliver landscape images
        //        thus QCAR SDK components (e.g. camera capturing) need to know 
        //        when we are in portrait mode. Before Android 2.2 there is no 
        //        standard, device-independent way to let the camera driver know 
        //        that we are in portrait mode as each device seems to require a
        //        different combination of settings to rotate camera preview 
        //        frames images to match portrait mode views. Because of this,
        //        we suggest that the activity using the QCAR SDK be locked
        //        to landscape mode if you plan to support Android 2.1 devices
        //        as well. Froyo is fine with both orientations.

我已阅读Changing Screen.orientation at Runtime,如果切换方向,屏幕高度和宽度不会改变。它们与默认方向保持一致,从而导致跟踪格式错误。

就个人而言,如果您改变方向,我认为您不会得到好结果,但为了确保您可以向Vuforia support提出要求。球队。请亲自检查屏幕高度和宽度是否在方向切换期间发生变化。如果是这样,您可以使用我认为可以解决问题的新值创建FrameBuffer