Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::gui::Renderer Class Reference
Collaboration diagram for oe::gui::Renderer:

Public Member Functions

 Renderer ()
 Constructor. Prepare the renderer.
 ~Renderer ()
 Destructor.
void setFontBlankData (const render::Texture *texture, const glm::vec2 &uv)
 Set uv coordinates and texture containing an opaque white pixel.
void render (const Manager &manager)
 Draw the UI using a manager.
void render (nk_context *ctx, const glm::uvec2 &dimensions)
 Draw the UI using nuklear context and dimensions.

Public Attributes

oe::render::Shader shader
 Shader used for rendering the GUI.

Protected Attributes

nk_convert_config * _nk_config
nk_buffer * _command_buffer
oe::render::Mesh _mesh

Constructor & Destructor Documentation

◆ Renderer()

oe::gui::Renderer::Renderer ( )
explicit

Constructor. Prepare the renderer.

Parameters
managerGUI manager

Member Function Documentation

◆ setFontBlankData()

void oe::gui::Renderer::setFontBlankData ( const render::Texture * texture,
const glm::vec2 & uv )

Set uv coordinates and texture containing an opaque white pixel.

Used to draw anything that is not a text

Note
It is suggested to have the white pixel somewhere inside your main "font" texture
Parameters
textureTexture containing a white pixel
uvTexture coordinates of the white pixel

Member Data Documentation

◆ shader

oe::render::Shader oe::gui::Renderer::shader

Shader used for rendering the GUI.

We send the some inputs to the shader To be compatible, your shaders must (at least) use those same inputs

Vertex layout:

// Vertex position
layout (location = 0) in vec2 aPosition;
// Texture coordinates
layout (location = 1) in vec2 aTexCoords;
// Color to multiply to texture
layout (location = 2) in vec4 aColor;

Uniforms:

// Projection matrix to draw the UI
uniform mat4 uProjection;
// UI component specific texture (can be font glyphs or image)
uniform sampler2D uTexture;

The documentation for this class was generated from the following file: