nomlib
Loading...
Searching...
No Matches
nom::RocketSDL2RenderInterface Class Reference

Rendering interfacing bridge between libRocket and nomlib. More...

#include <RocketSDL2RenderInterface.hpp>

Inheritance diagram for nom::RocketSDL2RenderInterface:
[legend]

Public Member Functions

 RocketSDL2RenderInterface (RenderWindow *window)
virtual void Release ()
 Implements Rocket::Core::SystemInterface::Release.
virtual void RenderGeometry (Rocket::Core::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rocket::Core::TextureHandle texture_handle, const Rocket::Core::Vector2f &translation)
 Called by Rocket when it wants to render geometry that it does not wish to optimise.
virtual void EnableScissorRegion (bool enable)
 Called by Rocket when it wants to enable or disable scissoring to clip content.
virtual void SetScissorRegion (int x, int y, int width, int height)
 Called by Rocket when it wants to change the scissor region.
virtual bool LoadTexture (Rocket::Core::TextureHandle &texture_handle, Rocket::Core::Vector2i &texture_dimensions, const Rocket::Core::String &source)
 Called by Rocket when a texture is required by the library.
virtual bool GenerateTexture (Rocket::Core::TextureHandle &texture_handle, const Rocket::Core::byte *source, const Rocket::Core::Vector2i &source_dimensions)
 Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.
virtual void ReleaseTexture (Rocket::Core::TextureHandle texture_handle)
 Called by Rocket when a loaded texture is no longer required.

Static Public Member Functions

static bool gl_init (int width, int height)
 Initialize OpenGL with the necessary settings for libRocket and SDL2 to be all friendly.

Public Attributes

RenderWindowwindow_
 nomlib interface bridge between SDL2 and libRocket

Static Private Attributes

static priv::glUseProgramObjectARB_func ctx_
 Shader context function pointer.

Detailed Description

Rendering interfacing bridge between libRocket and nomlib.

Note
Currently, only the OpenGL back-end for SDL2 is supported.
Todo
Add support for OpenGLES and OpenGLES2 (mobile platforms).
See also
http://mdqinc.com/blog/2013/01/integrating-librocket-with-sdl-2

Definition at line 62 of file RocketSDL2RenderInterface.hpp.

Member Function Documentation

◆ gl_init()

bool nom::RocketSDL2RenderInterface::gl_init ( int width,
int height )
static

Initialize OpenGL with the necessary settings for libRocket and SDL2 to be all friendly.

Returns
Boolean TRUE if OpenGL initialization is successful, and boolean FALSE on failure.
Parameters
widthThe width of the clipping plane (orthographic matrix).
heightThe height of the clipping plane (orthographic matrix).
Note
This method should be called before the construction of this object, after the creation of a RenderWindow, and before any other rendering (OpenGL or otherwise).
Remarks
This is not part of the libRocket interface, and is provided as part of nomlib's high-level initialization routines.

◆ Release()

virtual void nom::RocketSDL2RenderInterface::Release ( )
virtual

Implements Rocket::Core::SystemInterface::Release.

Remarks
Called when this file interface is released.

◆ SetScissorRegion()

virtual void nom::RocketSDL2RenderInterface::SetScissorRegion ( int x,
int y,
int width,
int height )
virtual

Called by Rocket when it wants to change the scissor region.

Todo
The clipping calculations are slightly off for the y / height dimensions. This bug can often be seen with use of libRocket's scrollbar feature (i.e.: visual debugger's element info window).

Member Data Documentation

◆ ctx_

priv::glUseProgramObjectARB_func nom::RocketSDL2RenderInterface::ctx_
staticprivate

Shader context function pointer.

Note
We bypass the use of GLEW by requesting this extension through SDL2.

Definition at line 127 of file RocketSDL2RenderInterface.hpp.

◆ window_

RenderWindow* nom::RocketSDL2RenderInterface::window_

nomlib interface bridge between SDL2 and libRocket

Remarks
The interface does not own the pointer.

Definition at line 120 of file RocketSDL2RenderInterface.hpp.


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