www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: lasuicida on February 03, 2012, 10:06:39 am

Title: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: lasuicida on February 03, 2012, 10:06:39 am
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
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: EgonOlsen on February 03, 2012, 10:12:20 am
Can you post the code that you are using for setting this in it's context?
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: lasuicida 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);
}
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: Vi_O 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.
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: EgonOlsen 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?
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: K24A3 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.
Title: Re: When i set up the screen to "LANDSCAPE" mode, there was a problem.
Post by: Thomas. 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...