private void GLElement_GLRenderStarted(object sender, EventArgs e) { #region FBO start if (UseFrameBuffer) { FBO.Activate(); FBO.FBOInitializeView(GLElement1.PerspectiveProjection, TransformOuter.Location.Z); } else { FBO.Deactivate(); } #endregion RenderToBuffer(); #region FBO finish if (UseFrameBuffer) { FBO.Deactivate(); GLElement1.InitializeView(); GL.ClearColor(0, .3f, .5f, 1); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.LoadIdentity(); // Now bind the texture to use it GL.ActiveTexture(TextureUnit.Texture0); FBO.Bind(); GLHelpers.Color4(Colors.Black); // to prevent it from being transparent // Tranform TransformOuter.Apply(); // Render with shader LightingShaderProgram.Texture1 = FBO.Texture; LightingShaderProgram.Activate(); //GLHelpers.Plane(1.3, 1.3, 0); // put it on a plane GLHelpers.Cube2D(1.7); // put it on a cube // Do some cleanup TransformOuter.Remove(); Texture2D.Disable2DTextures(); ShaderProgram.DisableShaders(); } #endregion }