LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
lg_vbo.c File Reference

Functions

LG_VBO LG_VBO_new (const void *vertex_data, unsigned int size)
 
int LG_VBO_set_data (LG_VBO *vbo, const void *vertex_data)
 
void LG_VBO_free (LG_VBO *vbo)
 
void LG_VBO_bind (LG_VBO *vbo)
 
void LG_VBO_unbind ()
 
LG_IBO LG_IBO_new (const void *vertex_indices, unsigned int size)
 
int LG_IBO_set_data (LG_IBO *ibo, const void *vertex_indices)
 
void LG_IBO_free (LG_IBO *ibo)
 
void LG_IBO_bind (LG_IBO *ibo)
 
void LG_IBO_unbind ()
 
LG_VAO LG_VAO_new ()
 
void LG_VAO_free (LG_VAO *vao)
 
void LG_VAO_bind (LG_VAO *vao, zboolean gl_checking)
 
void LG_VAO_unbind ()
 

Detailed Description

 === Wrapper functions to more easily create and manage VBOs, IBOs, and VAOs ===

Function Documentation

◆ LG_VBO_new()

LG_VBO LG_VBO_new ( const void *  vertex_data,
unsigned int  size 
)

Create a new VBO

Also set buffer data if vertex_data != NULL

VBO id set to LG_INVALID_BUF_OBJ_ID on error

Parameters
vertex_dataA pointer to data, may be NULL
sizeSize of data
Returns
A new LG_VBO

◆ LG_VBO_set_data()

int LG_VBO_set_data ( LG_VBO vbo,
const void *  vertex_data 
)

Set buffer data of an already created VBO

No size param

Parameters
vboA pointer to a LG_VBO
vertex_dataA pointer to data
Returns
LG_OK if OK

◆ LG_VBO_free()

void LG_VBO_free ( LG_VBO vbo)

Free resources of a VBO

Parameters
vboA pointer to a LG_VBO

◆ LG_VBO_bind()

void LG_VBO_bind ( LG_VBO vbo)

Bind a VBO

Parameters
vboA pointer to a LG_VBO

◆ LG_VBO_unbind()

void LG_VBO_unbind ( )

Unbind a VBO

◆ LG_IBO_new()

LG_IBO LG_IBO_new ( const void *  vertex_indices,
unsigned int  size 
)

Create a new IBO

Also set buffer data if vertex_indices != NULL

IBO id set to LG_INVALID_BUF_OBJ_ID on error

Parameters
vertex_indicesA pointer to indices, may be NULL
sizeSize of indices
Returns
A new LG_IBO

◆ LG_IBO_set_data()

int LG_IBO_set_data ( LG_IBO ibo,
const void *  vertex_indices 
)

Set buffer data of an already created IBO

No size param

Parameters
iboA pointer to a LG_IBO
vertex_indicesA pointer to indices
Returns
LG_OK if OK

◆ LG_IBO_free()

void LG_IBO_free ( LG_IBO ibo)

Free resources of an IBO

Parameters
iboA pointer to a LG_IBO

◆ LG_IBO_bind()

void LG_IBO_bind ( LG_IBO ibo)

Bind an IBO

Parameters
vboA pointer to a LG_IBO

◆ LG_IBO_unbind()

void LG_IBO_unbind ( )

Unbind an IBO

◆ LG_VAO_new()

LG_VAO LG_VAO_new ( )

Create a new VAO

VAO id set to LG_INVALID_BUF_OBJ_ID on error

When first binded, will store/'push' configs done by:

  • glEnableVertexAttribArray()
  • glDisableVertexAttribArray()
  • glVertexAttribPointer()

ie vertex attributes

Returns
A new LG_VAO

◆ LG_VAO_free()

void LG_VAO_free ( LG_VAO vao)

Free resources of a VAO

Parameters
vaoA pointer to a LG_VAO

◆ LG_VAO_bind()

void LG_VAO_bind ( LG_VAO vao,
zboolean  gl_checking 
)

Bind a VAO

When binded again, will restore/'pop' configs done by:

  • glEnableVertexAttribArray()
  • glDisableVertexAttribArray()
  • glVertexAttribPointer()

ie vertex attributes

Parameters
vaoA pointer to a LG_VAO
gl_checkingEnable (TRUE) / disable (FALSE) GL checking

◆ LG_VAO_unbind()

void LG_VAO_unbind ( )

UnbBind a VAO