public TextOutput ( TextVertexBuffer textBuffer, DrawElementsIndirectCommand[] drawCommands, SentanceBlockStorageBuffer storage) { TextBuffer = textBuffer; DrawCommands = drawCommands; Storage = storage; Stride = System.Runtime.InteropServices.Marshal.SizeOf (typeof(DrawElementsIndirectCommand)); }
static TextVertexBuffer PopulateBuffers (int vertexBuffer, int drawIDBuffer, int elementBuffer) { const int POSITION = 0; const int IN_TEXTURE = 1; const int DRAW_ID = 2; int offset = 0; /// VERTEX //vbo = GL.GenVertexArray(); //GL.BindVertexArray (vbo); //CheckGLError (); int elementCount = 3; int size = elementCount * sizeof(float); int location = POSITION; var vbo = new TextVertexBuffer (); vbo.in_position.Buffer = vertexBuffer; vbo.in_position.Location = location; vbo.in_position.Elements = elementCount; vbo.in_position.Offset = (IntPtr)offset; offset += size; elementCount = 2; size = elementCount * sizeof(float); location = IN_TEXTURE; vbo.in_texCoords.Buffer = vertexBuffer; vbo.in_texCoords.Location = location; vbo.in_texCoords.Elements = elementCount; vbo.in_texCoords.Offset = (IntPtr)offset; // SHARED BUFFER AT END offset += size; int stride = offset; vbo.in_position.Stride = stride; vbo.in_texCoords.Stride = stride; offset = 0; stride = sizeof(uint); elementCount = 1; size = elementCount * sizeof(uint); location = DRAW_ID; vbo.in_drawID.Buffer = drawIDBuffer; vbo.in_drawID.Location = location; vbo.in_drawID.Elements = elementCount; vbo.in_drawID.Stride = stride; vbo.in_drawID.Offset = (IntPtr)offset; vbo.in_drawID.Divisor = 1; vbo.Initialise (elementBuffer); return vbo; }
void ReleaseManagedResources() { TextBuffer = null; DrawCommands = null; Storage = null; }