GLSurfaceView.IRenderer.OnSurfaceChanged(IGL10, Int32, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当图面更改大小时调用。
[Android.Runtime.Register("onSurfaceChanged", "(Ljavax/microedition/khronos/opengles/GL10;II)V", "GetOnSurfaceChanged_Ljavax_microedition_khronos_opengles_GL10_IIHandler:Android.Opengl.GLSurfaceView/IRendererInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnSurfaceChanged(Javax.Microedition.Khronos.Opengles.IGL10? gl, int width, int height);
[<Android.Runtime.Register("onSurfaceChanged", "(Ljavax/microedition/khronos/opengles/GL10;II)V", "GetOnSurfaceChanged_Ljavax_microedition_khronos_opengles_GL10_IIHandler:Android.Opengl.GLSurfaceView/IRendererInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnSurfaceChanged : Javax.Microedition.Khronos.Opengles.IGL10 * int * int -> unit
参数
- gl
- IGL10
GL 接口。 用于 instanceof 测试接口是否支持 GL11 或更高版本接口。
- width
- Int32
width
- height
- Int32
身高
- 属性
注解
当图面更改大小时调用。
在创建图面后调用,每当 OpenGL ES 图面大小更改时。
通常,将在此处设置视区。 如果相机已修复,也可以在此处设置投影矩阵:
void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
// for a fixed camera, set the projection too
float ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。