Example #1
0
        protected override void OnStartBatch()
        {
            base.OnStartBatch();

            if ( Camera != null )
                GL.Uniform1( myFogDensityLoc, 2.0f / Camera.ViewDistance );

            GL.Enable( EnableCap.DepthTest );
            GL.Enable( EnableCap.Blend );
            GL.Enable( EnableCap.PrimitiveRestart );

            GL.CullFace( CullFaceMode.Back );
            GL.BlendFunc( BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha );
            GL.PrimitiveRestartIndex( 0xffff );

            myCurrentModel = null;
        }
Example #2
0
        public void Render( Model model )
        {
            if ( model != myCurrentModel )
            {
                if ( myCurrentModel != null )
                    myCurrentModel.VertexBuffer.EndBatch( this );

                lock( model )
                    if ( model.VertexBuffer == null )
                        model.SetupVertexBuffer();

                model.VertexBuffer.StartBatch( this );
                myCurrentModel = model;
            }

            model.Render( this );
        }