onSurfaceChanged的目的是什么? [英] what is the purpose of onSurfaceChanged?

查看:104
本文介绍了onSurfaceChanged的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不完全了解此方法的目的.在android文档中,他们说这是更改屏幕尺寸的时间.这是指视口的大小,还是确切地意味着什么?我应该在该方法中进行什么opengl调用.

I don't exactly understand what the purpose of this method is. In the android documentation, they say that this is when the size of the screen is changed. Does this mean the size of the viewport, or what exactly does it mean? What opengl calls should I make in the method.

推荐答案

当更改或首次创建视口的大小时,将调用该方法.此功能是您首先会确切知道GlSurfaceView占用多少像素的地方.

The method is called when the size of the viewport is changed or first created. This function is the first place where you will know exactly how many pixels your GlSurfaceView occupies.

在这种方法中,设置视口,也许设置投影矩阵将是适当的.

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

例如,如果屏幕从垂直旋转到水平,则视口的大小可能会改变,因此您应该重置视​​口和投影矩阵.

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

这篇关于onSurfaceChanged的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆