Module vbo
A friendly wrapper for setting up vertex buffer objects
vbo:bind () |
Bind the VBO
This will upload data to the GPU if the vbo.dirty flag is marked |
vbo:unbind () |
Unbind the VBO |
vbo:enable_position_attribute (shader, name) |
Set the buffer's position data as the source of a shader's attribute |
vbo:disable_position_attribute (shader, name) |
Disable the binding of position data as the source of a shader's attribute |
vbo:enable_normal_attribute (shader, name) |
Set the buffer's normal data as the source of a shader's attribute |
vbo:disable_normal_attribute (shader, name) |
Disable the binding of normal data as the source of a shader's attribute |
vbo:enable_color_attribute (shader, name) |
Set the buffer's color data as the source of a shader's attribute |
vbo:disable_color_attribute (shader, name) |
Disable the binding of color data as the source of a shader's attribute |
vbo:enable_texcoord_attribute (shader, name) |
Set the buffer's texcoord data as the source of a shader's attribute |
vbo:disable_texcoord_attribute (shader, name) |
Disable the binding of texcoord data as the source of a shader's attribute |
vbo:draw (primitive, first, count) |
Submit the buffer to be rendered |
Functions
-
vbo (n)
-
Create a vbo object
Parameters:
- n
number of vertices (default 3)
Returns:
vbo
Class vbo
A vertex buffer wrapper
-
vbo:bind ()
-
Bind the VBO
This will upload data to the GPU if the vbo.dirty flag is marked
Returns:
self
-
vbo:unbind ()
-
Unbind the VBO
Returns:
self
-
vbo:enable_position_attribute (shader, name)
-
Set the buffer's position data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "position")
Returns:
self
-
vbo:disable_position_attribute (shader, name)
-
Disable the binding of position data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "position")
Returns:
self
-
vbo:enable_normal_attribute (shader, name)
-
Set the buffer's normal data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "normal")
Returns:
self
-
vbo:disable_normal_attribute (shader, name)
-
Disable the binding of normal data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "normal")
Returns:
self
-
vbo:enable_color_attribute (shader, name)
-
Set the buffer's color data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "color")
Returns:
self
-
vbo:disable_color_attribute (shader, name)
-
Disable the binding of color data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "color")
Returns:
self
-
vbo:enable_texcoord_attribute (shader, name)
-
Set the buffer's texcoord data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "texcoord")
Returns:
self
-
vbo:disable_texcoord_attribute (shader, name)
-
Disable the binding of texcoord data as the source of a shader's attribute
Parameters:
- shader
the shader program to bind to
- name
the attribute name (default "texcoord")
Returns:
self
-
vbo:draw (primitive, first, count)
-
Submit the buffer to be rendered
Parameters:
- primitive
rendering style (default gl.TRIANGLES)
- first
the first index to render (default 0)
- count
the number of vertices to render (default self.count)
Returns:
self