protected void Setup() { var vs = DefaultShader.FromType(typeof(VertexPositionColorTexture), PlainCore.Graphics.Core.ShaderType.Vertex); var fs = DefaultShader.FromType(typeof(VertexPositionColorTexture), PlainCore.Graphics.Core.ShaderType.Fragment); pipeline = new ShaderPipeline(vs, fs); buffer = new VertexArrayBuffer <VertexPositionColorTexture>(32, OpenGL.BufferUsage.StaticDraw); indexBuffer = new IndexBuffer <VertexPositionColorTexture>(OpenGL.BufferUsage.StaticDraw); vao = new VertexArrayObject <VertexPositionColorTexture>(buffer, pipeline, DefaultVertexDefinition.FromType(typeof(VertexPositionColorTexture))); texture = new DeviceTexture(DefaultShader.DEFFAULT_TEXTURE_UNIFORM_NAME, 100, 100, true); defaultFramebuffer = Framebuffer.GetDefault(); var imageData = Image.Load("Example.png").SavePixelData(); texture.Bind(); texture.CopyData(imageData); buffer.Bind(); buffer.CopyData(_ArrayPosition); buffer.Unbind(); indexBuffer.Bind(); indexBuffer.CopyData(indexArray); indexBuffer.Unbind(); worldMatrix = new Matrix4fUniform(DefaultShader.MVP_UNIFORM_NAME); }
protected Texture(int width, int height, byte[] data, bool repeated = false) { deviceTexture = new DeviceTexture(DefaultShader.DEFFAULT_TEXTURE_UNIFORM_NAME, width, height, true, repeated); deviceTexture.Bind(); deviceTexture.CopyData(data); }