public void OnDrawFrame(IGL10 gl)
        {
            /*
             * Usually, the first thing one might want to do is to clear
             * the screen. The most efficient way of doing this is to use
             * glClear().
             */
            gl.GlClear(GL10.GlColorBufferBit | GL10.GlDepthBufferBit);

            /*
             * Now we're ready to draw some 3D objects
             */

            gl.GlMatrixMode(GL10.GlModelview);
            gl.GlLoadIdentity();
            gl.GlTranslatef(0, 0, -3.0f);
            gl.GlRotatef(mAngle, 0, 1, 0);
            gl.GlRotatef(mAngle * 0.25f, 1, 0, 0);

            gl.GlEnableClientState(GL10.GlVertexArray);
            gl.GlEnableClientState(GL10.GlColorArray);

            mCube.Draw(gl);

            gl.GlRotatef(mAngle * 2.0f, 0, 1, 1);
            gl.GlTranslatef(0.5f, 0.5f, 0.5f);

            mCube.Draw(gl);

            mAngle += 1.2f;
        }
        public void OnDrawFrame(IGL10 gl)
        {
            /*
             * Usually, the first thing one might want to do is to clear
             * the screen. The most efficient way of doing this is to use
             * glClear().
             */
            gl.GlClear (GL10.GlColorBufferBit | GL10.GlDepthBufferBit);

            /*
             * Now we're ready to draw some 3D objects
             */

            gl.GlMatrixMode (GL10.GlModelview);
            gl.GlLoadIdentity ();
            gl.GlTranslatef (0, 0, -3.0f);
            gl.GlRotatef (mAngle,        0, 1, 0);
            gl.GlRotatef (mAngle*0.25f,  1, 0, 0);

            gl.GlEnableClientState (GL10.GlVertexArray);
            gl.GlEnableClientState (GL10.GlColorArray);

            mCube.Draw (gl);

            gl.GlRotatef (mAngle*2.0f, 0, 1, 1);
            gl.GlTranslatef (0.5f, 0.5f, 0.5f);

            mCube.Draw (gl);

            mAngle += 1.2f;
        }
 public void OnDrawFrame(IGL10 gl)
 {
     // 清除屏幕缓存和深度缓存
     gl.GlClear(GL10.GlColorBufferBit | GL10.GlDepthBufferBit);
     // 启用顶点坐标数据
     gl.GlEnableClientState(GL10.GlVertexArray);
     // 启用贴图坐标数组数据
     gl.GlEnableClientState(GL10.GlTextureCoordArray);   // ①
                                                         // 设置当前矩阵模式为模型视图。
     gl.GlMatrixMode(GL10.GlModelview);
     gl.GlLoadIdentity();
     // 把绘图中心移入屏幕2个单位
     gl.GlTranslatef(0f, 0.0f, -2.0f);
     // 旋转图形
     gl.GlRotatef(ma.angleY, 0, 1, 0);
     gl.GlRotatef(ma.angleX, 1, 0, 0);
     // 设置顶点的位置数据
     gl.GlVertexPointer(3, GL10.GlFloat, 0, cubeVerticesBuffer);
     // 设置贴图的坐标数据
     gl.GlTexCoordPointer(2, GL10.GlFloat, 0, cubeTexturesBuffer); // ②
                                                                   // 执行纹理贴图
     gl.GlBindTexture(GL10.GlTexture2d, texture);                  // ③
                                                                   // 按cubeFacetsBuffer指定的面绘制三角形
     gl.GlDrawElements(GL10.GlTriangles, cubeFacetsBuffer.Remaining(),
                       GL10.GlUnsignedByte, cubeFacetsBuffer);
     // 绘制结束
     gl.GlFinish();
     // 禁用顶点、纹理坐标数组
     gl.GlDisableClientState(GL10.GlVertexArray);
     gl.GlDisableClientState(GL10.GlTextureCoordArray);
     // 递增角度值以便每次以不同角度绘制
 }
Beispiel #4
0
        public void OnDrawFrame(IGL10 gl)
        {
            gl.GlClear(IGL10Constants.GL_COLOR_BUFFER_BIT | IGL10Constants.GL_DEPTH_BUFFER_BIT);
            gl.GlLoadIdentity();

            gl.GlTranslatef(0.0f, 0.0f, -10.0f);
            gl.GlRotatef(mCubeRotation, 1.0f, 1.0f, 1.0f);

            mCube.Draw(gl);

            gl.GlLoadIdentity();

            mCubeRotation -= 0.7f;
        }
Beispiel #5
0
        public override void Present(float deltaTime)
        {
            IGL10 gl = _glGraphics.GL10;

            gl.GlClear(GL10.GlColorBufferBit);
            gl.GlMatrixMode(GL10.GlModelview);
            _vertices.Bind();
            for (int i = 0; i < NUM_BOBS; i++)
            {
                gl.GlLoadIdentity();


                gl.GlTranslatef(_bobs[i].dx, _bobs [i].dy, 0);
                gl.GlRotatef(_bobs[i].grad, 0, 0, -1f);

                _vertices.Draw(GL10.GlTriangles, 0, 6);
            }
            _vertices.Unbind();
        }
        public void OnDrawFrame(IGL10 gl)
        {
            mObserver.OnDrawFrame();

            gl.GlClearColor(Color.GetRedComponent(mBackgroundColor) / 255f,
                            Color.GetGreenComponent(mBackgroundColor) / 255f,
                            Color.GetBlueComponent(mBackgroundColor) / 255f,
                            Color.GetAlphaComponent(mBackgroundColor) / 255f);
            gl.GlClear(GL10.GlColorBufferBit);
            gl.GlLoadIdentity();

            if (USE_PERSPECTIVE_PROJECTION)
            {
                gl.GlTranslatef(0, 0, -6f);
            }

            for (int i = 0; i < mCurlMeshes.Count; ++i)
            {
                mCurlMeshes.ElementAt(i).OnDrawFrame(gl);
            }
        }