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


I'm experimenting with OpenGL E on Nexus One, there is a problem with full screen resolution. I could never get the absolute resolution of the Nexus One, which is 480 × 800, I am using an orthogonal projection and want to make a simple triangle with only the model model view matrix:

  @ Override public zero size perm It does not happen when we are attracted (GL 10GL, int width, intensity height) {/ * * set, our projection matrix, but changing the viewport size usually requires a new launch. * / Gl.glViewport (0, 0, width, height); Gl.glMatrixMode (GL10.GL_PROJECTION); Gl.glLoadIdentity (); GLU.gluOrtho2D (GL, 0, width, 0, height); }  

The coordinates for the triangle are:

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

And I get the following results:

This result is similar to emulator (480 × 800 race) and 1 Nexus. Obviously I did not get the full resolution (because the top peak of the triangle is already close to the right edge, if the width is actually 480, it should be on the left side of half width). Another strange thing is that in converting to size (I am using GLSurfaceView, this is the override method required by GLSurfaceView), I always get width = 480 and height = 800, even if any of the functions are in full screen mode . I was hoping that the shape size changed with the app title bar and status bar, should it be small to be replaced? I mean, if the pattern crossed if this method is not the actual size, how can I set up the right viewport?

I did the quick execution using the GLUUT on Windows with the same setup, drag the exact same triangle, I get the results below, which is the expected result. Can anyone help me understand this to get this same result on the phone?

I already have

  Android: Android: bigScreens = "true" android: normalScreens = "true" android: smallScreens Has put "true" Android: anyDensity = "true" /> In AndroidManifest.xml  

Specifically, I found that it looks like Android only: anyDensity = "true" | "False" cases because this sophisticated result changes does not change the results of others, besides my project is on SDK 1.6, which is recommended for the development of applications that support large phone screens.

The original question is also asked here:

thanks for all your answers They helped me a lot, I found you very embarrassing to tell you the real cause of this problem, which I solved now. The triangle class that I copied from a sample, actually scales on the coordinates, which you define in the position array by the factor of two! I have modified the coordinates in the array and I did not notice when they are loaded in the top buffer, they are scaled!

I am guilty ... but let's be careful with some imitation, just as you believe that the way you expect it to happen, but it is not, this is the triangle square , I have copied the code, and note that on line number 215, posts have increased by 2! In fact, evil as a sample ....

In addition, while using GLSurfaceView, your sample folder sdk_root \ platforms \ android-1.1 \ samples \ ApiDemos \ src \ com in GLSurfaceView.java Instead use android.opengl.GLSurfaceView. \ Examples \ Android \ apis \ Graphics. Since the latter is an early version and some strange behaviors.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -