public GraphicSystem(Camera camera, ResourceManager resource_manager) { Camera = camera; ResourceManager = resource_manager; // @todo Remove RenderContext.Window = Camera.Window; RenderContext.Projection = Camera.ProjectionMatrix; RenderContext.View = Camera.ViewMatrix; var texture_target = TextureTarget.Texture2D; RenderContext.DepthTexture = new Texture(texture_target); using (new Bind(RenderContext.DepthTexture)) { GL.TexImage2D(texture_target, 0, PixelInternalFormat.DepthComponent, 1024, 1024, 0, PixelFormat.DepthComponent, PixelType.Float, IntPtr.Zero); GL.TexParameter(texture_target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter(texture_target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(texture_target, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(texture_target, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(texture_target, TextureParameterName.TextureCompareMode, (int)TextureCompareMode.CompareRToTexture); GL.TexParameter(texture_target, TextureParameterName.TextureCompareFunc, (int)DepthFunction.Lequal); //GL.TexParameter(texture_target, TextureParameterName.DepthTextureMode, (int)All.Intensity); //GL.TexParameter(texture_target, TextureParameterName.DepthTextureMode, (int)All.Luminance); } frame_buffer = new FrameBuffer(FramebufferTarget.Framebuffer); frame_buffer.Texture(FramebufferAttachment.DepthAttachment, RenderContext.DepthTexture, 0); frame_buffer.DrawBuffer(DrawBufferMode.None); frame_buffer.CheckStatus(); }