public void Setup(MShader shader) { _shader = shader; CurrentModel = new Cube(); CurrentModel.Setup(); _camera = new MCamera(); _camera.Setup(); _geoShader = new MGeomShader(); _geoShader.Setup(); // configure depth map FBO // ----------------------- GL.Enable(EnableCap.DepthTest); //GL.GenFramebuffers(1, out depthMapFBO); //GL.GenTextures(1, out depthMap); //GL.BindTexture(TextureTarget.Texture2D, depthMap); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)OpenTK.Graphics.ES11.TextureWrapMode.Clamp); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)OpenTK.Graphics.ES11.TextureWrapMode.Clamp); //GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.DepthComponent, // 1024, 1024, 0, PixelFormat.DepthComponent, PixelType.Float, IntPtr.Zero); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureCompareFunc, CompareFun.GL_LEQUAL); float[] borderColor = { 1.0f, 0.0f, 0.0f, 1.0f }; GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureBorderColor, borderColor); // attach depth texture as FBO's depth buffer //GL.BindFramebuffer(FramebufferTarget.Framebuffer, depthMapFBO); //GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, TextureTarget.Texture2D, depthMap, 0); //GL.DrawBuffer(DrawBufferMode.None); //GL.ReadBuffer(ReadBufferMode.None); //GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); shader = new MShader("shader"); //simpleDepthShader = new MShader("simpleDepthShader"); //simpleDepthShader.Load("shadow_mapping_depth.vs", "shadow_mapping_depth.fs"); //debugDepthQuad = new MShader("debugDepthQuad"); //debugDepthQuad.Load("debug_quad.vs", "debug_quad.fs"); //debugDepthQuad.Bind(); //debugDepthQuad.SetInt("depthMap", 0); _texture = new MTexture(); _texture.Setup(@"textures\wood.png", @"textures\asteroid01.jpg"); Globals.texture = _texture; IsSetup = true; }
private void Form1_Load(object sender, EventArgs e) { shader = new MShader("shader"); renderer.Setup(shader); _editor.Setup(FragmentShaderEditor, VertexEditor, shader); _editor.SetFragShaderEditorStyle(new FastColoredTextBoxNS.TextChangedEventArgs(new FastColoredTextBoxNS.Range(FragmentShaderEditor))); _editor.SetVertexEditorStyle(new FastColoredTextBoxNS.TextChangedEventArgs(new FastColoredTextBoxNS.Range(VertexEditor))); }
public void Setup(FastColoredTextBoxNS.FastColoredTextBox in_fragEditor, FastColoredTextBoxNS.FastColoredTextBox in_vertexeditor, MShader shader) { frageditor = in_fragEditor; vertexeditor = in_vertexeditor; _shader = shader; LoadFragment(); LoadVertexShader(); }