Never got the full 480 * 800 when using 2D orthogonal projection in opengl-es

I am experimenting a bit with OpenGL ES on the Nexus One. There was a problem with the full screen resolution. It seems like I can never get the real full resolution of Nexus One, which is 480 * 800. I use orthogonal projection and just want to draw a simple triangle with the matrix representing the identity model:

@Override
 public void sizeChanged(GL10 gl, int width, int height) {
      /*
       * Set our projection matrix. This doesn't have to be done
       * each time we draw, but usually a new projection needs to
       * be set when the viewport is resized.
       */         
      gl.glViewport( 0, 0, width, height);

      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadIdentity();          
      GLU.gluOrtho2D(gl, 0, width, 0, height);                         
 } 

Coordinates for a triangle:

float[] coords = {
            // X, Y, Z
            0.0f, 0.0f, 0,
            200.0f, 200.0f, 0,
            100.0f, 0.0f, 0,
    }; 

And I get the result below:

alt text http://www.anddev.org/files/device_184.png

(480 * 800 res) Nexus 1. , ( , 480, ). , sizeChanged ( GLSurfaceView, , GLSurfaceView), width = 480 height = 800 , . , , sizeChanged, ? , , , , , ?

I also made a quick implementation using GLUT on Windows with the same setup and drew the same triangle. I get the result below, which is the expected result. Can anyone help me figure out how to get the same result over the phone?

alt text http://www.anddev.org/files/glut_on_win_137.png

I already put

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
tag

in AndroidManifest.xml. In particular, I found that it only looks like android: anyDensity = "true" | "false", as this changes the result. Others do not change the result at all. My project is also on SDK 1.6, which is recommended for developing applications that support a larger screen phone.

The original question is also asked here: http://www.anddev.org/viewtopic.php?p=34832#34832

+5
4

, . , . , , , , ! , , , !

... - , - , , , , http://code.google.com/p/apps-for-android/source/browse/trunk/Samples/OpenGLES/Triangle/src/com/google/android/opengles/triangle/TriangleRenderer.java , 215 2! ...

, GLSurfaceView android.opengl.GLSurfaceView GLSurfaceView.java sdk_root\platform\android-1.1\samples\ApiDemos\src\com\example\android\apis\graphics. .

+4

SDK 3

320x480 | 480x320 res

:

// we get some display information 
    display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    scrPixelFormat = display.getPixelFormat();
    scrWidth = display.getWidth(); 
    scrHeight = display.getHeight();
    scrRefreshRate = display.getRefreshRate();

, , sdk 6.

+1

, , - , android: minSdkVersion uses-sdk 4 . android: targetSdkVersion 4 .

, - Android 1.6, API 4. , Android 1.6, API, uses-sdk. , - Android 1.5 . Eclipse .

+1

I know there is an OpenGL thread covering the differences between 16., 2.0, etc. with detailed forms of these games for developers, etc., you will have to use this Google on the google homepage, as the google developers list is search sucks

I would also check the db error as anyone who detects OpenGl errors to put work in error reports, including me

Other places to check the alien3d project db error on googlecode on your Android 3D game engine, maybe they ran into it?

0
source

All Articles