I'm looking for a more elegant solution for obtaining the screen orientation in the GLES renderer in my code. I would like the clearcolor (among other things) in my OpenGLES view to change when the screen orientation changes. Right now I have a really kluge solution in the onSurfaceChanged
method where I fib a little:
int orientation;
if (height > width) {
orientation = 0;
} else {
orientation = 1;
}
This is not really what I want, since height and width could potentially be equal or even inverted if the GLES code gets used in a smaller sub-view later on. Can someone suggest a better way to allow the renderer to check the screen orientation when onSurfaceChanged
is called?