Skip to content

Commit

Permalink
GL3 renderer: Add utility functions
Browse files Browse the repository at this point in the history
To more easily enable client projects to render with their own shaders.
  • Loading branch information
mikke89 committed Jan 13, 2025
1 parent 728c163 commit d02fb09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Backends/RmlUi_Renderer_GL3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,16 @@ const Gfx::FramebufferData& RenderInterface_GL3::RenderLayerStack::EnsureFramebu
return fb;
}

const Rml::Matrix4f& RenderInterface_GL3::GetTransform() const
{
return transform;
}

void RenderInterface_GL3::ResetProgram()
{
UseProgram(ProgramId::None);
}

bool RmlGL3::Initialize(Rml::String* out_message)
{
#if defined RMLUI_PLATFORM_EMSCRIPTEN
Expand Down
5 changes: 5 additions & 0 deletions Backends/RmlUi_Renderer_GL3.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class RenderInterface_GL3 : public Rml::RenderInterface {
// Can be passed to RenderGeometry() to leave the bound texture and used program unchanged.
static constexpr Rml::TextureHandle TexturePostprocess = Rml::TextureHandle(-2);

// -- Utility functions for clients --

const Rml::Matrix4f& GetTransform() const;
void ResetProgram();

private:
void UseProgram(ProgramId program_id);
int GetUniformLocation(UniformId uniform_id) const;
Expand Down

0 comments on commit d02fb09

Please sign in to comment.