What is the purpose of onSurfaceChanged?

I do not quite understand what the purpose of this method is. In the documentation for Android, they say that this is when the screen size changes. Does this mean the size of the viewport, or what exactly does this mean? What opengl calls should be made in a method.

+3
source share
1 answer

The method is called when the viewport is resized or first created. This feature is the first place where you know exactly how many pixels your GlSurfaceView occupies.

In this method, it would be appropriate to set the viewport and possibly adjust the projection matrix.

For example, if the screen rotates from vertical to horizontal, the size of the viewport may change, so you must reset your view and projection matrices.

+8

All Articles