語言

GLSurfaceView.IRenderer.OnSurfaceChanged(IGL10, Int32, Int32) 方法

定義

當表面變大時會打電話。

[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);
            }

Java 文件 android.opengl.GLSurfaceView.Renderer.onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於