Author Topic: When i set up the screen to "LANDSCAPE" mode, there was a problem.  (Read 1478 times)

Offline lasuicida

  • byte
  • *
  • Posts: 2
    • View Profile
I achieved the effect by taking "helloworld" as an example.
But when i set up the screen to mode "LANDSCAPE", the cube disappeared.
Anybody knows the reason please tell me why.
thanks a lot. ;D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #1 on: February 03, 2012, 10:12:20 am »
Can you post the code that you are using for setting this in it's context?

Offline lasuicida

  • byte
  • *
  • Posts: 2
    • View Profile
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #2 on: February 03, 2012, 10:32:29 am »
Code: [Select]
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.camera_view);
initCamera();
initWorld();
}
private void initCamera() {
mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mSurfaceHolder.addCallback(this);
}
        private void initWorld() {
if (master != null) {
copy(master);
}
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);

renderer = new MyRenderer();
mGLView.setRenderer(renderer);

mGLView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
FrameLayout f = (FrameLayout) findViewById(R.id.camera_view_body);
f.addView(mGLView, 1);
}

Offline Vi_O

  • byte
  • *
  • Posts: 17
    • View Profile
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #3 on: February 03, 2012, 11:18:58 am »
try to set "landscape" from the AndroidManifest, It's cleaner and could even fix your problem.

here's the line :
Code: [Select]
android:screenOrientation="landscape"
Edit : put it in the activity proterty.
« Last Edit: February 03, 2012, 11:20:30 am by Vi_O »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #4 on: February 03, 2012, 11:23:16 am »
I'm doing it in code  all the time and it actually works fine. I think that this has something to do with the changes you made for supporting the camera or something. Does the HelloWorld-example survive a rotation of the device for you?

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #5 on: February 03, 2012, 02:39:01 pm »
The best way to force landscape is in the AndroidManifest file in this area:

Code: [Select]
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
        <activity android:name=".MyActivity"
          android:screenOrientation="landscape"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

This way will force landscape as soon as the app starts, and may speed up loading time.
« Last Edit: February 03, 2012, 02:40:59 pm by K24A3 »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
« Reply #6 on: February 03, 2012, 03:11:09 pm »
maybe off topic, but do you know, how can I change lanscape mode (90 and 270 automatic switching)? I mean that it is posible from android 2.3...