Q:

Incorrect display dimensions for Android OpenGL

I am using the DisplayMetrics to get the display dimensions of the Android phone as follow:
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;

Results give me height=854, width=480.
When I want the viewport to cover the whole screen as below, the viewport does not cover the complete display.
GLES20.glViewport(0,0,480,854);

Any explanations?

A:

It looks like the quad does not cover the whole screen. OpenGL screen coordinates range from -1 to 1 on both axis. Make sure the quad has a width and height of 2 if your not using a projection matrix. If you are using a projection matrix adjust the projection matrix parameters to project the quad on the entire screen or scale the quad to fit the the screen with current projection matrix.

