Renderer

struct glen::Renderer

Main entry point for rendering content.

Public Functions

Renderer(CameraNode *camera, const glm::uvec2 &dimensions)

Constructor.

Parameters
  • camera: The main viewing camera.

  • dimensions: The window dimensions.

bool poll_events()

Return

False if window has received ‘quit’ command.

void update(Window *window, Timer *timer)

Render a new frame using the window and timer.

void add_node(Node *node)

Add a Node to the renderer.

Nodes must be added to the renderer in order for them to appear in the window.

void enable_post_effects()

Enable all post process effects (tone mapping, glow, etc.)

void disable_post_effects()

Disable all post process effects (tone mapping, glow, etc.)

void enable_deferred_render()

Enable deferred rendering.

Requires that mesh nodes havea GBufferMaterial applied.

void disable_deferred_render()

Disable deferred rendering.

void enable_ao()

Enable ambient occlusion.

Ambient occlusion is a post processing effect that adds soft contact shadows to the render.

void disable_ao()

Disable ambient occlusion.

Window

struct glen::Window

A Window object sets up an OpenGL environment for all other components.

A new window must be constructed before any other components are added to the scene.

Public Functions

Window(std::string name, GLuint width, GLuint height)

Constructor.

Parameters
  • name: The window name.

  • width: Window width in pixels.

  • height: Window height in pixels.

Window(std::string name, std::vector<OpenGLAttrPair> st_config, GLuint width, GLuint height)

Constructor.

Parameters
  • name: The window name.

  • stconfig: A vector of key value pairs used to configure the OpenGL context.

  • width: Window width in pixels.

  • height: Window height in pixels.

~Window()
void append_title(std::string str)

The window title will appear as <Window name>=””> |

str
Parameters
  • str: Add this string to the window name.

void finish_frame()

Swap the old frame with the newly created frame.

GLint width()

Return

The window width in pixels.

GLint height()

Return

The window height in pixels.

Public Members

SDL_Window *m_st_window = nullptr
SDL_GLContext m_st_opengl = nullptr

Public Static Functions

std::vector<OpenGLAttrPair> create_default_config()

This can be used to construct a new

Window.
Return

A vector of key value pairs that can be used to configure a new Window.