Skip to content

Commit d8e1bca

Browse files
committed
load_* check for undef $pdl
1 parent eecfa2a commit d8e1bca

File tree

1 file changed

+3
-0
lines changed
  • lib/PDL/Graphics/TriD

1 file changed

+3
-0
lines changed

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ use OpenGL::Modern qw(
172172
);
173173
sub load_buffer {
174174
my ($this, $idname, $pdl, $target, $usage) = @_;
175+
PDL::barf ref($this)."::load_buffer: undef ndarray" if !defined $pdl;
175176
$target //= GL_ARRAY_BUFFER;
176177
$usage //= GL_STATIC_DRAW;
177178
my $id = $this->{Impl}{$idname} //= glGenBuffers_p(1);
@@ -181,10 +182,12 @@ sub load_buffer {
181182
}
182183
sub load_idx_buffer {
183184
my ($this, $idname, $pdl, $usage) = @_;
185+
PDL::barf ref($this)."::load_idx_buffer: undef ndarray" if !defined $pdl;
184186
$this->load_buffer($idname, $pdl, GL_ELEMENT_ARRAY_BUFFER, $usage);
185187
}
186188
sub load_texture {
187189
my ($this, $idname, $pdl, $iformat, $x, $y, $format, $type, $target) = @_;
190+
PDL::barf ref($this)."::load_texture: undef ndarray" if !defined $pdl;
188191
$type //= GL_FLOAT;
189192
$target //= GL_TEXTURE_2D;
190193
# ||= as only need one, even if re-setup

0 commit comments

Comments
 (0)