0

Im creating an app using OpenGL ES 2.0 on Mosync 3.3.1 and ideally I would like the screen to rotate to whatever orientation the screen is tilted. However using maScreenSetSupportedOrientations() and setting it to dynamic or landscape caused to the app to crash when it tries to rotate to landscape. Is this a bug that needs fixing or am I doing something wrong? Im sending my code to a nexus 7 tablet.

Im initiating the call in the init function of my code:

maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_DYNAMIC);
maScreenSetOrientation(MA_SCREEN_ORIENTATION_LANDSCAPE);

my whole code is available here: http://codetidy.com/6378/

D.Cole
  • 27
  • 10
  • The *maScreenSetSupportedOrientations()* function enables the possible orientations, the actual dynamic is called with *maScreenSetOrientation()*, could you perhaps post the part of the code that does this? – Floris Velleman Aug 06 '13 at 17:01
  • The MoSync documentation says _maScreenSetOrientation()_ is depreciated and to use _maScreenSetSupportedOritentaions()_ instead. I tried adding it in anyway but it still did not help. Ive now updated the question to show the lines of code at fault and added a link to my full code. – D.Cole Aug 07 '13 at 10:49
  • I am afraid you will have to debug a bit more (comment parts and see if it works with that), I personally think that it has to do with the opengl drawing in a spot it shouldn't. – Floris Velleman Aug 07 '13 at 11:22

1 Answers1

0

It works for me

extern "C" int MAMain() { // Declare MAMain function as "C"
maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_LANDSCAPE);
Moblet::run(new MyGLMoblet());
return 0;

instead of

void init() { // Screen Size

    mWidth = EXTENT_X(maGetScrSize());
    mHeight = EXTENT_Y(maGetScrSize());

    maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_PORTRAIT|MA_SCREEN_ORIENTATION_LANDSCAPE);
    maScreenSetOrientation(MA_SCREEN_ORIENTATION_LANDSCAPE);