コード例 #1
0
            void AccuracyRingRenderable::RenderSpheres(Eegeo::Rendering::GLState &glState) const
            {
                glState.BindTexture2D(0);
                glState.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

                glState.DepthMask(GL_FALSE);
                glState.DepthTest.Enable();
                glState.DepthFunc(GL_LESS);

                glState.CullFace.Disable();

                glState.StencilTest.Enable();
                glState.StencilFunc(GL_ALWAYS, 1, 0xFF);
                glState.StencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP);
                glState.StencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP);

                Eegeo::m44 transform;
                Eegeo::m44 mvp;
                transform.Scale(m_outerRingRadius*2);
                transform.SetRow(3, Eegeo::v4(m_cameraRelativePosition, 1.0f));
                Eegeo::m44::Mul(mvp, m_viewProjection, transform);
                m_sphereRenderable.SetModelViewProjection(mvp);
                m_sphereRenderable.Render(glState);

                transform.Scale(m_innerRingRadius*2);
                transform.SetRow(3, Eegeo::v4(m_cameraRelativePosition, 1.0f));
                Eegeo::m44::Mul(mvp, m_viewProjection, transform);
                m_sphereRenderable.SetModelViewProjection(mvp);
                m_sphereRenderable.Render(glState);
            }
コード例 #2
0
            void AccuracyRingRenderable::RenderClearStencil(Eegeo::Rendering::GLState& glState) const
            {
                m_colorMaterial.SetState(glState);

                glState.DepthMask(GL_FALSE);
                glState.DepthTest.Enable();
                glState.DepthFunc(GL_ALWAYS);
                glState.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
                glState.Blend.Disable();
                glState.StencilTest.Enable();
                glState.StencilFunc(GL_ALWAYS, StencilClear, 0xFF);
                glState.StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);

                m_quadRenderable.Render(glState);
            }