void PinOverModelExample::MyModelRenderable::Render(Eegeo::Rendering::GLState& glState) const
    {
        Eegeo::m44 transform;
        Eegeo::dv3 location = Eegeo::Space::LatLong::FromDegrees(37.7858,-122.401).ToECEF();
        Eegeo::v3 up(location.Norm().ToSingle());
        Eegeo::v3 forward = (location  - Eegeo::v3(0.f, 1.f, 0.f)).Norm().ToSingle();
        Eegeo::v3 right(Eegeo::v3::Cross(up, forward).Norm());
        forward = Eegeo::v3::Cross(up, right);
        Eegeo::v3 cameraRelativePos = (location - m_renderContext.GetCameraOriginEcef()).ToSingle();
        Eegeo::m44 scaleMatrix;
        scaleMatrix.Scale(1.f);
        Eegeo::m44 cameraRelativeTransform;
        cameraRelativeTransform.SetFromBasis(right, up, forward, cameraRelativePos);
        Eegeo::m44::Mul(transform, cameraRelativeTransform, scaleMatrix);
        transform.SetRow(3, Eegeo::v4(cameraRelativePos, 1.f));

        glState.DepthTest.Enable();
        glState.DepthFunc(GL_LEQUAL);

        //loaded model faces are ccw
        glState.FrontFace(GL_CCW);

        m_model.GetRootNode()->SetVisible(true);
        m_model.GetRootNode()->SetLocalMatrix(transform);
        m_model.GetRootNode()->UpdateRecursive();
        m_model.GetRootNode()->UpdateSphereRecursive();
        m_model.GetRootNode()->DrawRecursive(m_renderContext, m_globalFogging, NULL, true, false);

        glState.FrontFace(GL_CW);

        Eegeo::EffectHandler::Reset();
    }
            void AccuracyRingRenderable::RenderRingEffects(Eegeo::Rendering::GLState &glState) const
            {
                m_colorMaterial.SetState(glState);

                Eegeo::v4 ringCol = m_ringColor;
                Eegeo::v4 innerCol = m_innerColor;

                m_colorMaterial.SetColor(ringCol);
                glState.ColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
                glState.Blend.Enable();

                glState.StencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
                glState.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
                glState.StencilFunc(GL_EQUAL, StencilOuterLayer, 0xFF);
                glState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                glState.BlendEquation(GL_FUNC_ADD);

                m_quadRenderable.Render(glState);

                glState.Blend.Enable();
                glState.BlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
                glState.BlendEquation(GL_FUNC_ADD);
                glState.StencilFunc(GL_EQUAL, StencilInnerLayer, 0xFF);

                m_colorMaterial.SetColor(innerCol);
                m_quadRenderable.Render(glState);
            }
            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);
            }
            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);
            }