< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_vb library

Description

gh_vb is a module that manages OpenGL vertex buffers. gh_vb allows to create, set values and render simple vertex buffers.


Number of functions: 16

  1. gh_vb.bind (Lua - Python)
  2. gh_vb.create (Lua - Python)
  3. gh_vb.draw_lines (Lua - Python)
  4. gh_vb.draw_points (Lua - Python)
  5. gh_vb.draw_triangles (Lua - Python)
  6. gh_vb.kill (Lua - Python)
  7. gh_vb.map (Lua - Python)
  8. gh_vb.set_value_1f (Lua - Python)
  9. gh_vb.set_value_1ui (Lua - Python)
  10. gh_vb.set_value_2f (Lua - Python)
  11. gh_vb.set_value_3f (Lua - Python)
  12. gh_vb.set_value_4f (Lua - Python)
  13. gh_vb.set_value_4x4f (Lua - Python)
  14. gh_vb.set_vertex_attrib_data (Lua - Python)
  15. gh_vb.unbind (Lua - Python)
  16. gh_vb.unmap (Lua - Python)



bind

Description

Binds a vertex buffer.


Syntax

gh_vb.bind(
 vbid
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.bind(vbid)
			


create

Description

Creates a vertex buffer.


Syntax

vbid = gh_vb.create(
 buffer_size,
 num_vertex_attribs
)

Languages

Lua - Python


Parameters


Return Values


Code sample


vbid = gh_vb.create(buffer_size, num_vertex_attribs)
			


draw_lines

Description

Draws lines from a vertex buffer.


Syntax

gh_vb.draw_lines(
 vbid,
 count,
 start,
 render_mode
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


-- Draws the first 100 vertices as lines.
LINE_RENDER_DEFAULT = 0
LINE_RENDER_STRIP = 1
LINE_RENDER_LOOP = 2
gh_vb.draw_lines(vbid, 100, 0, LINE_RENDER_STRIP)
			


draw_points

Description

Draws points from a vertex buffer.


Syntax

gh_vb.draw_points(
 vbid,
 count,
 start
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


-- Draws the first 100 points.
gh_vb.draw_points(vbid, 100, 0)
			


draw_triangles

Description

Draws triangles from a vertex buffer.


Syntax

gh_vb.draw_triangles(
 vbid,
 count,
 start,
 triangle_mode
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


-- triangle modes:
TRIANGLE = 0
TRIANGLE_STRIP = 1
TRIANGLE_FAN = 9
-- Draws the first 90 vertices as triangles (30 triangles).
gh_vb.draw_triangles(vbid, 90, 0, TRIANGLE)
			


kill

Description

Kills a vertex buffer.


Syntax

gh_vb.kill(
 vbid
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.kill(vbid)
			


map

Description

Maps the vertex buffer to CPU memory. The buffer pointer returned by map() is valid until the next call to unmap.


Syntax

buffer_ptr, buffer_size = gh_vb.map(
 vbid,
 access_mode
)

Languages

Lua - Python


Parameters


Return Values


Code sample


buffer, buffer_size = gh_vb.map(vbid, "")
			


set_value_1f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_1f(
 vbid,
 buffer_offset_bytes,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 4
gh_vb.set_value_1f(vbid, offset, x)
			


set_value_1ui

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_1ui(
 vbid,
 buffer_offset_bytes,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 4
gh_vb.set_value_1ui(vbid, offset, x)
			


set_value_2f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_2f(
 vbid,
 buffer_offset_bytes,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 8
gh_vb.set_value_2f(vbid, offset, x, y)
			


set_value_3f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_3f(
 vbid,
 buffer_offset_bytes,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 12
gh_vb.set_value_3f(vbid, offset, x, y, z)
			


set_value_4f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_4f(
 vbid,
 buffer_offset_bytes,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 16
gh_vb.set_value_4f(vbid, offset, x, y, z, w)
			


set_value_4x4f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_4x4f(
 vbid,
 buffer_offset_bytes,
 m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 64
gh_vb.set_value_4x4f(vbid, offset, m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15)
			


set_vertex_attrib_data

Description

Specifies the description of a vertex attibute. This description will be used to render the vertex array.


Syntax

gh_vb.set_vertex_attrib_data(
 vbid,
 vertex_attrib_index,
 attrib_location,
 type,
 dim,
 stride,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.set_vertex_attrib_data(vbid, vertex_attrib_index, attrib_location, type, dim, stride, offset)
			


unbind

Description

Unbinds a vertex buffer.


Syntax

gh_vb.unbind(
 vbid
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.unbind(vbid)
			


unmap

Description

Unmaps the vertex buffer.


Syntax

gh_vb.unmap(
 vbid
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.unmap(vbid)
			






GeeXLab Rootard Guide | Downloads | Contact | Newsletter