//protected const int MAXOUTPUTS = 16; //protected OperatorOutput[] outputs = new OperatorOutput[MAXOUTPUTS]; public OperatorComponentBase(bool usingFilenames = true, params Tuple <ShaderType, string>[] shaderSourceOrFilenames) { Vector3[] vertex = { new Vector3(-1f, 1f, 0f), new Vector3(-1f, -1f, 0f), new Vector3(1f, 1f, 0f), new Vector3(1f, -1f, 0f) }; uint[] index = { 0, 1, 2, 1, 3, 2 }; // vertices for OpenGL coordinate space and an identity projection. Resources.Add(VertexBuffer = vertex.ToBufferObject("vertex")); Resources.Add(IndexBuffer = index.ToBufferObject("index", BufferTarget.ElementArrayBuffer)); if (shaderSourceOrFilenames != null && shaderSourceOrFilenames.Length > 0) { Shader = new ReloadableResource <ShaderProgram>("shader", () => new ShaderProgram("shader_internal", "vertex", "", usingFilenames, shaderSourceOrFilenames), (s) => new ShaderProgram(s)); Resources.Add(Shader); } }
public TestComponent2() { Resources.Add(shader = new ReloadableResource <ShaderProgram>("p2r", () => new ShaderProgram( "p2", "vertex", "", true, "testshader2.glsl|vert", "testshader2.glsl|frag" ), (s) => new ShaderProgram(s))); Resources.Add(vertexBuffer = BufferObject <Vector3> .CreateVertexBuffer("vbuf", ScreenTri.Vertices().ToArray())); Resources.Add(indexBuffer = BufferObject <uint> .CreateIndexBuffer("ibuf", ScreenTri.Indices().ToArray())); ModelMatrix = Matrix4.CreateTranslation(0.0f, 0.0f, -0.1f); ProjectionMatrix = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 0.0f, 1.0f, 0.001f, 2.0f); }
private void BasicParticleRenderer_Loading(object sender, EventArgs e) { InitVBOs(); program = new ReloadableResource <ShaderProgram>("proghost", () => { return(new ShaderProgram("prog", "vertex", "", true, VertexShaderName, FragmentShaderName)); }, (sp) => new ShaderProgram(sp)); Resources.Add(program); }