< 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 ()
  2. gh_vb.create ()
  3. gh_vb.draw_lines ()
  4. gh_vb.draw_points ()
  5. gh_vb.draw_triangles ()
  6. gh_vb.kill ()
  7. gh_vb.map ()
  8. gh_vb.set_value_1f ()
  9. gh_vb.set_value_1ui ()
  10. gh_vb.set_value_2f ()
  11. gh_vb.set_value_3f ()
  12. gh_vb.set_value_4f ()
  13. gh_vb.set_value_4x4f ()
  14. gh_vb.set_vertex_attrib_data ()
  15. gh_vb.unbind ()
  16. gh_vb.unmap ()



bind

Description

Binds a vertex buffer.


Syntax

gh_vb.bind(
 vb_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.bind(vb_id)
			


create

Description

Creates a vertex buffer.


Syntax

vb_id = gh_vb.create(
 buff_size,
 num_vertex_attribs
)

Languages


Parameters


Return Values


Code sample


vb_id = gh_vb.create(buffer_size, num_vertex_attribs)
			


draw_lines

Description

Draws lines from a vertex buffer.


Syntax

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

Languages


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(vb_id, 100, 0, LINE_RENDER_STRIP)
			


draw_points

Description

Draws points from a vertex buffer.


Syntax

gh_vb.draw_points(
 vb_id,
 count,
 start
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


draw_triangles

Description

Draws triangles from a vertex buffer.


Syntax

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

Languages


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(vb_id, 90, 0, TRIANGLE)
			


kill

Description

Kills a vertex buffer.


Syntax

gh_vb.kill(
 vb_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.kill(vb_id)
			


map

Description

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


Syntax

buff_ptr, buff_size = gh_vb.map(
 vb_id,
 access_mode
)

Languages


Parameters


Return Values


Code sample


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


set_value_1f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_1f(
 vb_id,
 buff_offset_bytes,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_1ui

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_1ui(
 vb_id,
 buff_offset_bytes,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_2f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_2f(
 vb_id,
 buff_offset_bytes,
 x, y
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_3f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_3f(
 vb_id,
 buff_offset_bytes,
 x, y, z
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_4f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_4f(
 vb_id,
 buff_offset_bytes,
 x, y, z, w
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_4x4f

Description

Sets a value in the vertex buffer.


Syntax

gh_vb.set_value_4x4f(
 vb_id,
 buff_offset_bytes,
 m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 64
gh_vb.set_value_4x4f(vb_id, offset, m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,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(
 vb_id,
 vertex_attrib_index,
 attrib_location,
 type,
 dim,
 stride,
 offset
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


unbind

Description

Unbinds a vertex buffer.


Syntax

gh_vb.unbind(
 vb_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.unbind(vb_id)
			


unmap

Description

Unmaps the vertex buffer.


Syntax

gh_vb.unmap(
 vb_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_vb.unmap(vb_id)
			






GeeXLab Rootard Guide | Downloads | Contact