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
寬度
- height
- Int32
height
- 屬性
備註
當表面變大時會打電話。
在曲面建立後呼叫,且 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);
}
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。