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];
float color[4];
} 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
|
| 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.
|
|
◆ BUFFER_OFFSET
#define BUFFER_OFFSET |
( |
| i | ) |
|
Value:
To give a offset number as pointer value.