< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_vertex_pool library

Description

gh_vertex_pool is the module that manages a pool of vertices (or an array of vertices).


Number of functions: 19

  1. gh_vertex_pool.create (Lua - Python)
  2. gh_vertex_pool.render (Lua - Python)
  3. gh_vertex_pool.set_vertex_source (Lua - Python)
  4. gh_vertex_pool.vertex_get_color (Lua - Python)
  5. gh_vertex_pool.vertex_set_color (Lua - Python)
  6. gh_vertex_pool.vertex_get_position (Lua - Python)
  7. gh_vertex_pool.vertex_set_position (Lua - Python)
  8. gh_vertex_pool.vb_get_vertex_color (Lua - Python)
  9. gh_vertex_pool.vb_get_vertex_normal (Lua - Python)
  10. gh_vertex_pool.vb_get_vertex_position (Lua - Python)
  11. gh_vertex_pool.vb_get_vertex_tangent (Lua - Python)
  12. gh_vertex_pool.vb_map (Lua - Python)
  13. gh_vertex_pool.vb_set_vertex_color (Lua - Python)
  14. gh_vertex_pool.vb_set_vertex_normal (Lua - Python)
  15. gh_vertex_pool.vb_set_vertex_position (Lua - Python)
  16. gh_vertex_pool.vb_set_vertex_tangent (Lua - Python)
  17. gh_vertex_pool.vb_unmap (Lua - Python)
  18. gh_vertex_pool.vertices_from_gpu_buffer (Lua - Python)
  19. gh_vertex_pool.vertices_to_gpu_buffer (Lua - Python)



create

Description

Creates a vertex pool.


Syntax

vp_id = gh_vertex_pool.create(
 num_vertices
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
vp = gh_vertex_pool.create(1000)
            


render

Description

Renders a vertex pool.


Syntax

gh_vertex_pool.render(
 vp,
 start_vertex,
 num_vertices
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.render(vp, 0, -1)
            


set_vertex_source

Description

Set the source of the vertices of a vertex pool.


Syntax

gh_vertex_pool.set_vertex_source(
 vp,
 gpu_buffer_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.set_vertex_source(vp, gpu_buffer_id)
            


vertex_get_color

Description

Gets the color of a particular vertex.


Syntax

r, g, b, a = gh_vertex_pool.vertex_get_color(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
 r, g, b, a = gh_vertex_pool.vertex_get_color(vp, index)
            


vertex_set_color

Description

Sets the color of a particular vertex.


Syntax

gh_vertex_pool.vertex_set_color(
 vp,
 index,
 r, g, b, a
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vertex_set_color(vp, index, r, g, b, a)
            


vertex_get_position

Description

Gets the position of a particular vertex.


Syntax

x, y, z, w = gh_vertex_pool.vertex_get_position(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_vertex_pool.vertex_get_position(vp, index)
            


vertex_set_position

Description

Sets the position of a particular vertex.


Syntax

gh_vertex_pool.vertex_set_position(
 vp,
 index,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vertex_set_position(vp, index, x, y, z, 1.0)
            


vb_get_vertex_color

Description

Gets the color of a vertex in a mapped GPU memory.


Syntax

r, g, b, a = gh_vertex_pool.vb_get_vertex_color(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
r, g, b, a = gh_vertex_pool.vb_get_vertex_color(vp, offset)
            


vb_get_vertex_normal

Description

Gets the normal of a vertex in a mapped GPU memory.


Syntax

x, y, z, w = gh_vertex_pool.vb_get_vertex_normal(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_vertex_pool.vb_get_vertex_normal(vp, offset)
            


vb_get_vertex_position

Description

Gets the position of a vertex in a mapped GPU memory.


Syntax

x, y, z, w = gh_vertex_pool.vb_get_vertex_position(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_vertex_pool.vb_get_vertex_position(vp, offset)
            


vb_get_vertex_tangent

Description

Gets the tangent of a vertex in a mapped GPU memory.


Syntax

x, y, z, w = gh_vertex_pool.vb_get_vertex_tangent(
 vp,
 index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_vertex_pool.vb_get_vertex_tangent(vp, offset)
            


vb_map

Description

Maps the GPU memory of the vertex buffer into CPU address space.


Syntax

gh_vertex_pool.vb_map(
 vp
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_map(vp)
            


vb_set_vertex_color

Description

Sets the color of a vertex in a mapped GPU memory.


Syntax

gh_vertex_pool.vb_set_vertex_color(
 vp,
 index,
 r, g, b, a
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_map(vp)
for i=0, z_max-1 do
  for j=0, x_max-1 do
    local offset = i*z_max + j
    r, g, b, a = gh_vertex_pool.vb_get_vertex_color(vp, offset)
    -- Do some stuff with r, g, b, a.
    -- ...
    gh_vertex_pool.vb_set_vertex_color(vp, offset, r, g, b, a)
  end
end
gh_vertex_pool.vb_unmap(vp)
            


vb_set_vertex_normal

Description

Sets the normal of a vertex in a mapped GPU memory.


Syntax

gh_vertex_pool.vb_set_vertex_normal(
 vp,
 index,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_map(vp)
gh_vertex_pool.vb_set_vertex_normal(vp, vertex_index, x, y, z, w)
gh_vertex_pool.vb_unmap(vp)
            


vb_set_vertex_position

Description

Sets the position of a vertex in a mapped GPU memory.


Syntax

gh_vertex_pool.vb_set_vertex_position(
 vp,
 index,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_map(vp)
for i=0, z_max-1 do
  for j=0, x_max-1 do
    local offset = i*z_max + j
    x, y, z, w = gh_vertex_pool.vb_get_vertex_position(vp, offset)
    y1 = 2.0 * math.cos(elapsed_time + x * 0.1) + math.sin(elapsed_time + z * 0.1);
    y2 = 2.0 * math.sin(elapsed_time + x * 0.1) + math.cos(elapsed_time + z * 0.1);
    gh_vertex_pool.vb_set_vertex_position(vp, offset, x, y1+y2, z, w)
  end
end
gh_vertex_pool.vb_unmap(vp)
            


vb_set_vertex_tangent

Description

Sets the tangent of a vertex in a mapped GPU memory.


Syntax

gh_vertex_pool.vb_set_vertex_tangent(
 vp,
 index,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_map(vp)
gh_vertex_pool.vb_set_vertex_tangent(vp, vertex_index, x, y, z, w)
gh_vertex_pool.vb_unmap(vp)
            


vb_unmap

Description

Unmaps the GPU memory of the vertex buffer.


Syntax

gh_vertex_pool.vb_unmap(
 vp
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vb_unmap(vp)
            


vertices_from_gpu_buffer

Description

Copies all vertices from a GPU buffer to a vertex pool.


Syntax

gh_vertex_pool.vertices_from_gpu_buffer(
 vp,
 gpu_buffer_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vertices_from_gpu_buffer(vp, gpu_buffer_id)
            


vertices_to_gpu_buffer

Description

Copies all vertices to a GPU buffer.


Syntax

gh_vertex_pool.vertices_to_gpu_buffer(
 vp,
 gpu_buffer_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_vertex_pool.vertices_to_gpu_buffer(vp, gpu_buffer_id)
            






GeeXLab Rootard Guide | Downloads | Contact | Newsletter