public void OnSurfaceChanged(IGL10 gl, int width, int height) { gl.GlViewport(0, 0, width, height); gl.GlMatrixMode(IGL10Constants.GL_PROJECTION); gl.GlLoadIdentity(); GLU.GluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.GlViewport(0, 0, width, height); gl.GlMatrixMode(IGL10Constants.GL_MODELVIEW); gl.GlLoadIdentity(); }
public void OnSurfaceChanged(IGL10 gl, int width, int height) { gl.GlViewport(0, 0, width, height); mViewportWidth = width; mViewportHeight = height; float ratio = (float)width / height; mViewRect.Top = 1.0f; mViewRect.Bottom = -1.0f; mViewRect.Left = -ratio; mViewRect.Right = ratio; UpdatePageRects(); gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); if (USE_PERSPECTIVE_PROJECTION) { GLU.GluPerspective(gl, 20f, (float)width / height, .1f, 100f); } else { GLU.GluOrtho2D(gl, mViewRect.Left, mViewRect.Right, mViewRect.Bottom, mViewRect.Top); } gl.GlMatrixMode(GL10.GlModelview); gl.GlLoadIdentity(); }
public override void Present(float deltaTime) { IGL10 gl = _glGraphics.GL10; gl.GlViewport(0, 0, _glGraphics.Width, _glGraphics.Height); gl.GlClearColor(0, 0, 0, 1); gl.GlClear(GL10.GlColorBufferBit); gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); gl.GlOrthof(0, 540, 0, 960, 1, -1); gl.GlEnable(GL10.GlTexture2d); gl.GlBlendFunc(GL10.GlSrcAlpha, GL10.GlOneMinusSrcAlpha); gl.GlEnable(GL10.GlBlend); gl.GlBindTexture(GL10.GlTexture2d, _textureId); gl.GlEnableClientState(GL10.GlVertexArray); gl.GlEnableClientState(GL10.GlTextureCoordArray); _vertices.Position(0); gl.GlVertexPointer(2, GL10.GlFloat, _vertexSize, _vertices); _vertices.Position(2); gl.GlTexCoordPointer(2, GL10.GlFloat, _vertexSize, _vertices); gl.GlDrawArrays(GL10.GlTriangles, 0, 3); //gl.GlDisableClientState(GL10.GlVertexArray); //gl.GlDisableClientState(GL10.GlTextureCoordArray); }
public void OnSurfaceChanged(IGL10 gl, int width, int height) { // 设置3D视窗的大小及位置 gl.GlViewport(0, 0, width, height); // 将当前矩阵模式设为投影矩阵 gl.GlMatrixMode(GL10.GlProjection); // 初始化单位矩阵 gl.GlLoadIdentity(); // 计算透视视窗的宽度、高度比 float ratio = (float)width / height; // 调用此方法设置透视视窗的空间大小。 gl.GlFrustumf(-ratio, ratio, -1, 1, 1, 10); }
public void OnSurfaceChanged (IGL10 gl, int width, int height) { gl.GlViewport (0, 0, width, height); /* * Set our projection matrix. This doesn't have to be done * each time we draw, but usually a new projection needs to * be set when the viewport is resized. */ float ratio = (float) width / height; gl.GlMatrixMode (GL10.GlProjection); gl.GlLoadIdentity (); gl.GlFrustumf (-ratio, ratio, -1, 1, 1, 10); }
public void OnSurfaceChanged(IGL10 gl, int width, int height) { gl.GlViewport(0, 0, width, height); /* * Set our projection matrix. This doesn't have to be done * each time we draw, but usually a new projection needs to * be set when the viewport is resized. */ float ratio = (float)width / height; gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); gl.GlFrustumf(-ratio, ratio, -1, 1, 1, 10); }
public override void Present(float delta) { IGL10 gl = _glGraphics.GL10; gl.GlViewport(0, 0, _glGraphics.Width, _glGraphics.Height - 200); gl.GlClear(GL10.GlColorBufferBit); gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); gl.GlOrthof(0, 540, 0, 960, 1, -1); gl.GlColor4f(1, 0, 0, 1); gl.GlEnableClientState(GL10.GlVertexArray); _vertices.Position(0); gl.GlVertexPointer(2, GL10.GlFloat, _vertexSize, _vertices); gl.GlDrawArrays(GL10.GlTriangles, 0, 3); }
public override void Resume() { IGL10 gl = _glGraphics.GL10; gl.GlViewport(0, 0, _glGraphics.Width, _glGraphics.Height); gl.GlClearColor(0, 1, 0, 1); gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); gl.GlOrthof(0, 540, 0, 960, 1, -1); gl.GlEnable(GL10.GlTexture2d); _texture.Reload(); //_texture.BindTexture (); }
public override void Present(float deltaTime) { IGL10 gl = _glGraphics.GL10; gl.GlViewport(0, 0, _glGraphics.Width, _glGraphics.Height); gl.GlClear(GL10.GlColorBufferBit); gl.GlMatrixMode(GL10.GlProjection); gl.GlLoadIdentity(); gl.GlOrthof(0, 540, 0, 960, 1, -1); gl.GlEnable(GL10.GlTexture2d); _texture.BindTexture(); gl.GlEnableClientState(GL10.GlVertexArray); gl.GlEnableClientState(GL10.GlTextureCoordArray); _vertices.Position(0); gl.GlVertexPointer(2, GL10.GlFloat, _vertexSize, _vertices); _vertices.Position(2); gl.GlTexCoordPointer(2, GL10.GlFloat, _vertexSize, _vertices); gl.GlDrawElements(GL10.GlTriangles, 6, GL10.GlUnsignedShort, _indices); }
public void OnSurfaceChanged(IGL10 gl, int width, int height) { float ratio = (float)width / height; //����OpenGL�����Ĵ�С gl.GlViewport(0, 0, width, height); //����ͶӰ���� gl.GlMatrixMode(GL10.GlProjection); //����ͶӰ���� gl.GlLoadIdentity(); // �����ӿڵĴ�С viewport[2] = width; viewport[3] = height; OnZoomReset(true); m_bViewRest = false; mbChangeView = true; //GL.Ortho(-mdSizeFactorX, mdSizeFactorX, -mdSizeFactorY, mdSizeFactorY, mdzNear, mdzFar); //updateMatrix(); // Calculate the aspect ratio of the window // ѡ��ģ�۲���� gl.GlMatrixMode(GL10.GlModelview); // ����ģ�۲���� gl.GlLoadIdentity(); // gl.glViewport(0, 0, width, height); // gl.glMatrixMode(GL10.GL_PROJECTION); // gl.glLoadIdentity(); // float ratio = (float)width / height; // gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); //gl.GlGetIntegerv(GL11.GlViewport, viewport_buf); //GLES20.GlGetFloatv(GL11.GlModelviewMatrix, mvmatrix_buf); //GLES20.GlGetFloatv(GL11.GlProjectionMatrix, projmatrix_buf); }