Skip to content

Commit 509bc4c

Browse files
committed
recreate font texture if destroyed eg by window close/reopen
1 parent 7d5e90e commit 509bc4c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • lib/PDL/Graphics/TriD

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ sub DESTROY {
334334
{ package # hide from PAUSE
335335
PDL::Graphics::TriD::Labels;
336336
use OpenGL::Modern qw(
337-
glEnable glBlendFunc
337+
glEnable glBlendFunc glIsTexture
338338
glDrawElements_c
339339
GL_BLEND GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
340340
GL_TRIANGLES GL_UNSIGNED_INT
@@ -369,12 +369,12 @@ sub _font_setup {
369369
sub togl_setup {
370370
my ($this,$points) = @_;
371371
print "togl_setup $this\n" if $PDL::Graphics::TriD::verbose;
372-
if (!keys %FONT) {
372+
if (keys %FONT and glIsTexture($FONT{font_id})) {
373+
$this->{Impl}{font_id} = $FONT{font_id};
374+
} else {
373375
_font_setup(\%FONT);
374376
$this->load_texture(font_id => $FONT{texture}, GL_RGBA32F, ($FONT{texture}->dims)[1,2], GL_RGBA);
375377
$FONT{font_id} = $this->{Impl}{font_id};
376-
} else {
377-
$this->{Impl}{font_id} = $FONT{font_id};
378378
}
379379
$points //= $this->{Points}; # as Labels is used in Graph
380380
my $numchars = $FONT{numchars};

0 commit comments

Comments
 (0)