0

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?

keaukraine
  • 5,315
  • 29
  • 54
djphd
  • 125
  • 4
  • 3
    http://stackoverflow.com/questions/4697631/android-screen-orientation – Submersed Jan 02 '14 at 15:08
  • Basically, your question has nothing to do with OpenGL ES and is related only to getting orientation of Android device. Please be patient and do a better search over SO next time, @Submersed have pointed you to necessary question. – keaukraine Jan 03 '14 at 07:30
  • I'm just now starting to realize my noobness. I did see that question on my initial search, but trying the code didn't work. I guess my problem is figuring out how to access resources like the window manager when I'm not inside the Activity class. Apparently this is a much more fundamental issue.... – djphd Jan 03 '14 at 18:44

0 Answers0