Exemplo n.º 1
0
        void Render(IntPtr pParam)
        {
            // retrieving OpenGL texture
            ICoreTexture pCoreTex;

            pTex.GetCoreTexture(out pCoreTex);
            IOpenGLTextureContainer    pGLTex;
            IBaseRenderObjectContainer pGLObj;

            pCoreTex.GetBaseObject(out pGLObj);
            pGLTex = (IOpenGLTextureContainer)pGLObj;

            uint GLTex;     // OpenGL texture Id

            pGLTex.GetTexture(out GLTex);

            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glEnable(Gl.GL_LIGHT0);

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, GLTex);

            Gl.glPushMatrix();

            Gl.glTranslatef(0f, 0f, -1.5f);
            Gl.glRotatef(uiCounter / 2f, 0.6f, 0.2f, 0.3f);

            // We can also acess geometry buffer via pMesh->GetGeometryBuffer(p_geom_buff) and then p_geom_buff->GetBaseObject(...).
            // But it is easier to use engine.
            pMesh.Draw();

            Gl.glPopMatrix();

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, 0);

            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glDisable(Gl.GL_LIGHT0);

            // If you've corrupted engine pipeline somehow, you may want to invalidate state manager.
            // And remember that IRender3D can also cache some states.
            //pCoreRenderer->InvalidateStateFilter();
        }