3

I am Integrating JPCT-AE with Vuforia for as Vuforia sample ImageTarget teapot model. I followed the kelmar and Sam Rad's answer and now I am able to render my model as well as teapot but in landscape mode only.

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

When I make changes in initApplication() in ImageTarget

int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR; 
                                        or  ORIENTATION_PORTRATE;

My model starts rendering here and there on the screen which means it's not the way that teapot is rendered. As I understand, we need to change the matrix something to render model in portrait mode.

But I don't know how. If you have any idea, please refer me shortly.

Sam R.
  • 16,027
  • 12
  • 69
  • 122
ashunkhs
  • 61
  • 1
  • 7

1 Answers1

0

This is a quote from Vuforia sample code:

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.

I have read on Changing Screen.orientation at Runtime that screen height and width do not change if you switch the orientation. They stay the same as default orientation which results to malformed tracking.

Personally, I don't think that you get a good result if you change the orientation but in order to make sure you can ask from Vuforia support. team. Check it for yourself to see whether screen height and width change during orientation switch or not. If so, you may create your FrameBuffer with new values which I believe will solve your problem.

Sam R.
  • 16,027
  • 12
  • 69
  • 122
  • thanks for reply , i go the point . as i asked to vuforia moderator AlessandroB , he also reply : Vuforia axis system are somehow defined in landscape mode. and told swap the X & Y axis and set it in JPCT camera object. but i don't understand where i will get the axis and where i have to set . if u did it then please tell me some clue . this is the vuforia commu link ... https://developer.vuforia.com/forum/android/integrating-jpct-ae-vuforia – ashunkhs Apr 15 '13 at 05:14
  • @ashunkhs, Sorry I didn't do that because I didn't need portrait mode. Why do you even need portrait? What is your intention? – Sam R. Apr 15 '13 at 06:56
  • actually my app is in portrait mode . i can't change its UI design. So i need to change it as my app. – ashunkhs Apr 15 '13 at 10:27
  • thanks Sam ..i got it .thanks for your help. now its working in portrait mode also. – ashunkhs Apr 16 '13 at 08:25
  • @ashunkhs, Glad to hear that. You may post your solution as an answer to your own question and accept it. It may be useful for future visitors. Also, I suggest to change the question title to `Vuforia and jPCT in portrait` or something more descriptive like that. – Sam R. Apr 16 '13 at 08:28