protected override void initShaders() { _init = new Shader("rendering/transparency/wsum/init", ShaderType.FragmentShader); _init.complile(ShaderType.FragmentShader); _initing = new Shading(); _initing.create(); if (Example._scene.tessellation) { _initing.attachShader(Example._scene.renderVertexTess.id); _initing.attachShader(Example._scene.renderTessellationControl.id); _initing.attachShader(Example._scene.renderTessellationEvaluation.id); } else { _initing.attachShader(Example._scene.renderVertex.id); } _initing.attachShader(Example._scene.renderGeometry.id); _initing.attachShader(Example._scene.phongFragment.id); _initing.attachShader(Example._scene.computePixelColor.id); _initing.attachShader(_init.id); _initing.link(); _initing.use(); { _initing.bindBuffer(0, "Camera", Example._scene.camera.buffer.index, BufferRangeTarget.UniformBuffer); _initing.bindBuffer(1, "Light", Example._scene.light.buffer.index, BufferRangeTarget.UniformBuffer); } Shading.close(); _render = new Shader("rendering/transparency/wsum/render", ShaderType.FragmentShader); _render.complile(ShaderType.FragmentShader); _rendering = new Shading(); _rendering.create(); _rendering.attachShader(Texture.vertex.id); _rendering.attachShader(_render.id); _rendering.link(); _rendering.use(); { _rendering.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); _rendering.bindUniform1("width", Example._scene.width); _rendering.bindUniform1("height", Example._scene.height); } Shading.close(); }
protected override void initShaders() { _render = new Shader("rendering/transparency/wsum/dual/render", ShaderType.FragmentShader); _render.complile(ShaderType.FragmentShader); _rendering = new Shading(); _rendering.create(); _rendering.attachShader(Texture.vertex.id); _rendering.attachShader(_render.id); _rendering.link(); _rendering.use(); { _rendering.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); }
static Texture() { _image = new Image(); _sampler = new Sampler(); //--- final pass Shader _vertex = new Shader("image/render", ShaderType.VertexShader); _fragment = new Shader("image/render", ShaderType.FragmentShader); _vertex.complile(ShaderType.VertexShader); _fragment.complile(ShaderType.FragmentShader); _rendering = new Shading(); _rendering.create(); _rendering.attachShader(_vertex.id); _rendering.attachShader(_fragment.id); _rendering.link(); modelview_matrix = Matrix4.CreateOrthographicOffCenter(0, 1, 0, 1, -1, 1); _rendering.use(); { _rendering.bindUniformMatrix4("modelview_matrix", false, ref modelview_matrix); int _multisamples = 8; //GL.GetInteger(GetPName.MaxSamples, out _multisamples); _rendering.bindUniform1("samples", _multisamples); } Shading.close(); _fragment_background = new Shader("image/render_background", ShaderType.FragmentShader); _fragment_background.complile(ShaderType.FragmentShader); _rendering_background = new Shading(); _rendering_background.create(); _rendering_background.attachShader(_vertex.id); _rendering_background.attachShader(_fragment_background.id); _rendering_background.link(); _rendering_background.use(); { _rendering_background.bindUniformMatrix4("modelview_matrix", false, ref modelview_matrix); _rendering_background.bindUniform1("width", Example._scene.width); _rendering_background.bindUniform1("height", Example._scene.height); } Shading.close(); _copy = new Shader("image/copy", ShaderType.FragmentShader); _copy.complile(ShaderType.FragmentShader); _copying = new Shading(); _copying.create(); _copying.attachShader(_vertex.id); _copying.attachShader(_copy.id); _copying.link(); _copying.use(); { _copying.bindUniformMatrix4("modelview_matrix", false, ref modelview_matrix); } Shading.close(); }
public void initShaders() { // Render Shaders { _renderVertex = new Shader("rendering/render", ShaderType.VertexShader); _renderVertexRegions = new Shader("rendering/render_regions", ShaderType.VertexShader); _renderGeometry = new Shader("rendering/render", ShaderType.GeometryShader); _renderGeometryRegions = new Shader("rendering/render_regions", ShaderType.GeometryShader); _renderFragment = new Shader("rendering/render", ShaderType.FragmentShader); _renderFragmentRegions = new Shader("rendering/render_regions", ShaderType.FragmentShader); _phongFragment = new Shader("rendering/illumination", ShaderType.FragmentShader); _computePixelColor = new Shader("rendering/compute_pixel_color", ShaderType.FragmentShader); _renderVertex.complile(ShaderType.VertexShader); _renderVertexRegions.complile(ShaderType.VertexShader); _renderGeometry.complile(ShaderType.GeometryShader); _renderGeometryRegions.complile(ShaderType.GeometryShader); _phongFragment.complile(ShaderType.FragmentShader); _computePixelColor.complile(ShaderType.FragmentShader); _renderFragment.complile(ShaderType.FragmentShader); _renderFragmentRegions.complile(ShaderType.FragmentShader); } // Tessellated Render Shaders if (_tessellation) { GL.PatchParameter(PatchParameterInt.PatchVertices, 3); //float PatchInnerLevel = 1.0f; //float PatchOuterLevel = 1.0f; //GL.PatchParameter(PatchParameterFloat.PatchDefaultInnerLevel, ref PatchInnerLevel); //GL.PatchParameter(PatchParameterFloat.PatchDefaultOuterLevel, ref PatchOuterLevel); _renderVertexTess = new Shader("rendering/render_tess", ShaderType.VertexShader); _renderVertexTess.complile(ShaderType.VertexShader); _renderTessellationControl = new Shader("Control/render", ShaderType.TessControlShader); _renderTessellationControl.complile(ShaderType.TessControlShader); _renderTessellationEvaluation = new Shader("Evaluation/render", ShaderType.TessEvaluationShader); _renderTessellationEvaluation.complile(ShaderType.TessEvaluationShader); } // AABB-ConvexHull Shaders { _aabb_chVertex = new Shader("aabb-ch/render", ShaderType.VertexShader); _aabb_chFragment = new Shader("aabb-ch/render", ShaderType.FragmentShader); _aabb_chVertex.complile(ShaderType.VertexShader); _aabb_chFragment.complile(ShaderType.FragmentShader); _aabb_chRendering = new Shading(); _aabb_chRendering.create(); _aabb_chRendering.attachShader(_aabb_chVertex.id); _aabb_chRendering.attachShader(_aabb_chFragment.id); _aabb_chRendering.link(); _aabb_chRendering.use(); { _aabb_chRendering.bindBuffer(0, "Camera", _camera.buffer.index, BufferRangeTarget.UniformBuffer); } Shading.close(); } // Sphere Shaders { _sphereVertex = new Shader("sphere/render", ShaderType.VertexShader); _sphereFragment = new Shader("sphere/render", ShaderType.FragmentShader); _sphereVertex.complile(ShaderType.VertexShader); _sphereFragment.complile(ShaderType.FragmentShader); _sphereRendering = new Shading(); _sphereRendering.create(); _sphereRendering.attachShader(_sphereVertex.id); _sphereRendering.attachShader(_sphereFragment.id); _sphereRendering.link(); _sphereRendering.use(); { _sphereRendering.bindBuffer(0, "Camera", _camera.buffer.index, BufferRangeTarget.UniformBuffer); } Shading.close(); } // Thickness Shaders { _thickVertex = new Shader("rendering/translucency/compute", ShaderType.VertexShader); _thickVertex.complile(ShaderType.VertexShader); _thickCompute = new Shader("rendering/translucency/compute", ShaderType.FragmentShader); _thickCompute.complile(ShaderType.FragmentShader); _thickComputing = new Shading(); _thickComputing.create(); _thickComputing.attachShader(_thickVertex.id); _thickComputing.attachShader(_thickCompute.id); _thickComputing.link(); _thickComputing.use(); { _thickComputing.bindBuffer(0, "Camera", _camera.buffer.index, BufferRangeTarget.UniformBuffer); } Shading.close(); #if peel _thickCompute_f2b = new Shader("rendering/translucency/f2b/compute", ShaderType.FragmentShader); _thickCompute_f2b.complile(ShaderType.FragmentShader); _thickComputing_f2b = new Shading(); _thickComputing_f2b.create(); _thickComputing_f2b.attachShader(Texture.vertex.id); _thickComputing_f2b.attachShader(_thickCompute_f2b.id); _thickComputing_f2b.link(); _thickComputing_f2b.use(); { _thickComputing_f2b.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); _thickCompute_dual = new Shader("rendering/translucency/dual/compute", ShaderType.FragmentShader); _thickCompute_dual.complile(ShaderType.FragmentShader); _thickComputing_dual = new Shading(); _thickComputing_dual.create(); _thickComputing_dual.attachShader(Texture.vertex.id); _thickComputing_dual.attachShader(_thickCompute_dual.id); _thickComputing_dual.link(); _thickComputing_dual.use(); { _thickComputing_dual.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); _thickCompute_k_buffer = new Shader("rendering/translucency/k_buffer/compute", ShaderType.FragmentShader); _thickCompute_k_buffer.complile(ShaderType.FragmentShader); _thickComputing_k_buffer = new Shading(); _thickComputing_k_buffer.create(); _thickComputing_k_buffer.attachShader(Texture.vertex.id); _thickComputing_k_buffer.attachShader(_thickCompute_k_buffer.id); _thickComputing_k_buffer.link(); _thickComputing_k_buffer.use(); { _thickComputing_k_buffer.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); _thickCompute_k_multi_buffer_Z = new Shader("rendering/translucency/k_multi_buffer_Z/compute", ShaderType.FragmentShader); _thickCompute_k_multi_buffer_Z.complile(ShaderType.FragmentShader); _thickComputing_k_multi_buffer_Z = new Shading(); _thickComputing_k_multi_buffer_Z.create(); _thickComputing_k_multi_buffer_Z.attachShader(Texture.vertex.id); _thickComputing_k_multi_buffer_Z.attachShader(_thickCompute_k_multi_buffer_Z.id); _thickComputing_k_multi_buffer_Z.link(); _thickComputing_k_multi_buffer_Z.use(); { _thickComputing_k_multi_buffer_Z.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); _thickCompute_k_stencil_buffer = new Shader("rendering/translucency/k_stencil_buffer/compute", ShaderType.FragmentShader); _thickCompute_k_stencil_buffer.complile(ShaderType.FragmentShader); _thickComputing_k_stencil_buffer = new Shading(); _thickComputing_k_stencil_buffer.create(); _thickComputing_k_stencil_buffer.attachShader(Texture.vertex.id); _thickComputing_k_stencil_buffer.attachShader(_thickCompute_k_stencil_buffer.id); _thickComputing_k_stencil_buffer.link(); _thickComputing_k_stencil_buffer.use(); { _thickComputing_k_stencil_buffer.bindUniformMatrix4("modelview_matrix", false, ref Texture.modelview_matrix); } Shading.close(); #endif } }