Skip to content

Commit

Permalink
what if we just kept the texture handle away from Rml
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFloofyKitsune committed Apr 5, 2024
1 parent 53baf84 commit 51804e0
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 252 deletions.
4 changes: 4 additions & 0 deletions rts/Rml/Backends/RmlUi_Renderer_GL3_Spring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ bool RenderInterface_GL3_Spring::GenerateTexture(Rml::TextureHandle& texture_han

void RenderInterface_GL3_Spring::ReleaseTexture(Rml::TextureHandle texture_handle)
{
// Something was using a texture loaded/managed outside of Rml. Do nothing.
if (texture_handle == TextureEnableWithoutBinding)
return;

glDeleteTextures(1, (GLuint*)&texture_handle);
}

Expand Down
3 changes: 3 additions & 0 deletions rts/Rml/Backends/RmlUi_Renderer_GL3_Spring.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class RenderInterface_GL3_Spring : public Rml::RenderInterface {
void SetTransform(const Rml::Matrix4f* transform) override;

// Can be passed to RenderGeometry() to enable texture rendering without changing the bound texture.
// Can used as the output of a TextureCallback to signal that this texture is externally managed.
// In that case, you will need to keep a reference to the texture
// you want and bind it before rendering the geometry.
static const Rml::TextureHandle TextureEnableWithoutBinding = Rml::TextureHandle(-1);

private:
Expand Down
Loading

0 comments on commit 51804e0

Please sign in to comment.