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

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 a 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

std::unique_ptr< oe::render::Shadershader
 Shader used for rendering the GUI.
 

Protected Attributes

std::unique_ptr< nk_convert_config > _nk_config
 
std::unique_ptr< nk_buffer > _cmd_buffer
 
std::unique_ptr< oe::render::DynamicMesh_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 a 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

std::unique_ptr<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: