Example #1
0
    /* My scene rendering logic */
    private void RenderScene()
    {
        UpdateScene();

        // Clearing all
        //GL.ClearColor(backgroundColour[0], backgroundColour[1], backgroundColour[2], backgroundColour[3]);

        //If you're drawing a scene that covers the whole screen each frame (for example when using skyBox), only clear depth buffer but not the color buffer.
        //The buffers should always be cleared. On much older hardware, there was a technique to get away without clearing the scene, but on even semi-recent hardware, this will actually make things slower. So always do the clear.
        GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
        //GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
        //GL.Clear(ClearBufferMask.DepthBufferBit);

        // Updating camera parameters basing on the used inputDevice. Also passing frameDelta here for fps dependent behavior
        cam.updateCameraParams(mouse, frameDelta, this);

        // Looking in the right direction
        ShadersCommonProperties.viewMatrix = Matrix4.LookAt(cam.Eye, cam.Target, cam.Up);

        // Drawing SkyBox
        skyBox.DrawSkyBox(frameDelta);         //Passing frameDelta for fps dependent animations

        // apply camera transform
        cam.Transform();         //model matrix is modified

        // render the nodes, just render a slice for now, it renders in order
        foreach (SliceManager node in sceneList)
        {
            node.Render();
            this.culledThisFrame = node.culledTotal;
        }
    }