public override void Initialize() { var vertexData = new Vertex[MaxVertices]; vertexData[0] = Vertex.Cannon; var vertexBufferSource = Context.Create.Buffer(BufferTarget.TransformFeedback, Vertex.SizeInBytes * MaxVertices, BufferUsageHint.StaticDraw, vertexData); var vertexBufferTarget = Context.Create.Buffer(BufferTarget.TransformFeedback, Vertex.SizeInBytes * MaxVertices, BufferUsageHint.StaticDraw); vertexArraySource = Context.Create.VertexArray(); vertexArraySource.SetVertexAttributeF(0, vertexBufferSource, VertexAttributeDimension.Two, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 0); vertexArraySource.SetVertexAttributeF(1, vertexBufferSource, VertexAttributeDimension.Two, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 2 * sizeof(float)); vertexArraySource.SetVertexAttributeF(2, vertexBufferSource, VertexAttributeDimension.One, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 4 * sizeof(float)); vertexArraySource.SetVertexAttributeI(3, vertexBufferSource, VertexAttributeDimension.One, VertexAttribIPointerType.Int, Vertex.SizeInBytes, 5 * sizeof(float)); vertexArraySource.SetVertexAttributeF(4, vertexBufferSource, VertexAttributeDimension.Three, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 6 * sizeof(float)); vertexArrayTarget = Context.Create.VertexArray(); vertexArrayTarget.SetVertexAttributeF(0, vertexBufferTarget, VertexAttributeDimension.Two, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 0); vertexArrayTarget.SetVertexAttributeF(1, vertexBufferTarget, VertexAttributeDimension.Two, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 2 * sizeof(float)); vertexArrayTarget.SetVertexAttributeF(2, vertexBufferTarget, VertexAttributeDimension.One, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 4 * sizeof(float)); vertexArrayTarget.SetVertexAttributeI(3, vertexBufferTarget, VertexAttributeDimension.One, VertexAttribIPointerType.Int, Vertex.SizeInBytes, 5 * sizeof(float)); vertexArrayTarget.SetVertexAttributeF(4, vertexBufferTarget, VertexAttributeDimension.Three, VertexAttribPointerType.Float, false, Vertex.SizeInBytes, 6 * sizeof(float)); transformFeedbackSource = Context.Create.TransformFeedback(); transformFeedbackSource.SetBuffer(0, vertexBufferSource); transformFeedbackTarget = Context.Create.TransformFeedback(); transformFeedbackTarget.SetBuffer(0, vertexBufferTarget); timeBuffer = Context.Create.Buffer(BufferTarget.Uniform, 2 * sizeof(float), BufferUsageHint.DynamicDraw); IVertexShader vsh = Context.Create.VertexShader(VertexShaderText); IGeometryShader gsh = Context.Create.GeometryShader(GeometryShaderText); IFragmentShader fsh = Context.Create.FragmentShader(FragmentShaderText); program = Context.Create.Program(new ShaderProgramDescription { VertexShaders = new[] { vsh }, GeometryShaders = new[] { gsh }, FragmentShaders = new[] { fsh }, VertexAttributeNames = new[] { "in_position", "in_velocity", "in_timeToAction", "in_type", "in_color" }, TransformFeedbackAttributeNames = new[] { "g_position", "g_velocity", "g_timeToAction", "g_type", "g_color" }, TransformFeedbackMode = TransformFeedbackMode.InterleavedAttribs, UniformBufferNames = new[] { "Time" } }); }