public void Begin(Matrix transform, BlendMode blendMode = BlendMode.BlendmodeAlpha, TextureSampling textureSampling = null, ColorTextureEffect effect = null) { Debug.Assert(!hasBegun, "Called Begin() twice"); hasBegun = true; this.transform = transform; this.blendMode = blendMode; this.textureSampling = textureSampling ?? TextureSampling.LinearClamp; this.currentEffect = effect ?? defaultEffect; }
public TextureFill() { defaultEffect = new ColorTextureEffect(defaultVs, defaultFs); GL.GenBuffers(2, vertexBufferObjects); indices = new ushort[6]; indices[0] = 0; indices[1] = 2; indices[2] = 1; indices[3] = 1; indices[4] = 2; indices[5] = 3; vertices = new Vertex2Tex2Color[4]; GL.BindBuffer(BufferTarget.ElementArrayBuffer, vertexBufferObjects[1]); GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(ushort)), indices, BufferUsageHint.StaticDraw); }
public QuadBatch(int defaultCapacity = 8192) { defaultEffect = new ColorTextureEffect(defaultVs, defaultFs); currentEffect = defaultEffect; capacity = defaultCapacity; Debug.Assert(capacity > 0); quads = new Quad[capacity]; indices = new ushort[capacity * 6]; fontLayout = new FontLayout(); InitIndices(); GL.GenBuffers(2, vertexBufferObjects); //GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBufferObjects[0]); //GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(capacity * 6 * Vertex2Tex2Color.GetSize()), IntPtr.Zero, BufferUsageHint.DynamicDraw); GL.BindBuffer(BufferTarget.ElementArrayBuffer, vertexBufferObjects[1]); GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(ushort)), indices, BufferUsageHint.StaticDraw); }