glamour



abstract interface  IBuffer;

Interface every buffer implements


abstract void  bind();




abstract void  unbind();




void  set_data(T)(ref const T data, GLenum hint = GL_STATIC_DRAW);




class  ElementBuffer: glamour.vbo.IBuffer;

Represents an OpenGL element buffer. The constructor must be used to avoid segmentation faults.


GLuint  buffer;

The OpenGL  buffer name.


GLenum  hint;

Specifies the expected usage pattern of the data store.


size_t  length;

Length of the passed data, note it's the  length of a void[] array.


this()();

Initializes the buffer.


this(T)(auto ref const T data, GLenum hint = GL_STATIC_DRAW);
this(T)(const T ptr, size_t size, GLenum hint = GL_STATIC_DRAW);

Initualizes the buffer and sets data.


void  remove();

Deletes the buffer.


void  bind();

Binds the buffer.


void  unbind();

Unbinds the buffer.


void  set_data(T)(auto ref const T data, GLenum hint = GL_STATIC_DRAW);
void  set_data(T)(const T ptr, size_t size, GLenum hint = GL_STATIC_DRAW);

Uploads data to the GPU.


class  Buffer: glamour.vbo.IBuffer;

Represents an OpenGL buffer. The constructor must be used to avoid segmentation faults.


GLuint  buffer;

The OpenGL  buffer name.


GLenum  hint;

Specifies the expected usage pattern of the data store.


size_t  length;

Length of the passed data, note it's the  length of a void[] array.


this(T)(auto ref const T data, GLenum hint = GL_STATIC_DRAW);
this(T)(const T ptr, size_t size, GLenum hint = GL_STATIC_DRAW);

Initualizes the buffer and sets data.

Parameters
data any kind of data.
type OpenGL type of the data (e.g. GL_FLOAT)
hint Specifies the expected usage pattern of the data store.

void  remove();

Deletes the buffer.


void  bind();

Binds the buffer.


void  bind(GLint attrib_location, GLenum type, GLint size, GLsizei offset, GLsizei stride, GLboolean normalized = GL_FALSE);
void  bind(Shader shader, string location, GLenum type, GLint size, GLsizei offset, GLsizei stride, GLboolean normalized = GL_FALSE);

Binds the buffer and sets the vertex attrib pointer.

Parameters
GLenum type Specifies the data type of each component in the array.
GLint size Specifies the number of components per generic vertex attribute.
GLsizei offset Specifies a offset of the first component of the first generic vertex attribute in the array in the data store of the buffer.
GLsizei stride Specifies the byte offset between consecutive generic vertex attributes.
GLboolean normalized Specifies whether fixed-point data values should be normalized (GL_TRUE) or converted directly as fixed-point values (GL_FALSE = default) when they are accessed.

void  unbind();

Unbinds the buffer.


void  set_data(T)(auto ref const T data, GLenum hint = GL_STATIC_DRAW);
void  set_data(T)(const T ptr, size_t size, GLenum hint = GL_STATIC_DRAW);

Uploads data to the GPU.


void  update(T)(ref const T data, GLintptr offset);
void  update(T)(const T ptr, size_t size, GLintptr offset);

Updates the Buffer, using glBufferSubData.