//------------------------------------------------------------------------------------------------------------------------
 //                                                        RenderSelf
 //------------------------------------------------------------------------------------------------------------------------
 protected virtual void RenderSelf(GLContext glContext)
 {
     if (visible == false) return;
     glContext.PushMatrix(matrix);
     glContext.PopMatrix();
 }
        //------------------------------------------------------------------------------------------------------------------------
        //                                                        Render
        //------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// This function is called by the renderer. You can override it to change this object's rendering behaviour.
        /// When not inside the GXPEngine package, specify the parameter as GXPEngine.Core.GLContext.
        /// This function was made public to accomoadate split screen rendering. Use SetViewPort for that.
        /// </summary>
        /// <param name='glContext'>
        /// Gl context, will be supplied by internal caller.
        /// </param>
        public virtual void Render(GLContext glContext)
        {
            if (visible) {
                glContext.PushMatrix(matrix);

                RenderSelf (glContext);
                foreach (GameObject child in GetChildren()) {
                    child.Render(glContext);
                }

                glContext.PopMatrix();
            }
        }