Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches

Auxiliary functions for Open GL
This group includes help for definitions, functions, and classes for OpenGL. More...

Topics

 GL Shader Program
 

Class: kodi::gui::gl::CShaderProgram

Class to manage an OpenGL shader program
With this class the used GL shader code can be defined on the GPU and its variables can be managed between CPU and GPU.
 

Macros

#define BUFFER_OFFSET(i)
 To give a offset number as pointer value.
 

Detailed Description

Auxiliary functions for Open GL
This group includes help for definitions, functions, and classes for OpenGL.

To use OpenGL for your system, add the #include <kodi/gui/gl/GL.h>.

The HAS_GL is declared if Open GL is required and HAS_GLES if Open GL Embedded Systems (ES) is required, with ES the version is additionally given in the definition, this can be "2" or "3".


Following GL_TYPE_STRING define can be used, for example, to manage different folders for GL and GLES and make the selection easier. This are on OpenGL "GL" and on Open GL|ES "GLES".

Example:

kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/frag.glsl");

In addition, BUFFER_OFFSET is declared in it which can be used to give an offset on the array to GL.

Example:

const struct PackedVertex {
float position[3]; // Position x, y, z
float color[4]; // Color r, g, b, a
} vertices[3] = {
{ { -0.5f, -0.5f, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
{ { 0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
{ { 0.0f, 0.5f, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } }
};
glVertexAttribPointer(m_aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, position)));
glEnableVertexAttribArray(m_aPosition);
glVertexAttribPointer(m_aColor, 4, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, color)));
glEnableVertexAttribArray(m_aColor);
#define BUFFER_OFFSET(i)
To give a offset number as pointer value.
Definition GL.h:108
color
Definition modules_cpp_peripheral_lifetime_diagram_1.dox:7
Definition GUITextureGLES.h:20

Macro Definition Documentation

◆ BUFFER_OFFSET

#define BUFFER_OFFSET ( i)
Value:
((char*)nullptr + (i))

To give a offset number as pointer value.