Skip to content

Commit 4377579

Browse files
committed
Points to use glDrawArrays
1 parent 9c1166f commit 4377579

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/PDL/Graphics/OpenGLQ.pd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ sub make_func {
112112
}
113113
}
114114

115-
make_func($_) for qw(gl_line_strip gl_points);
115+
make_func($_) for qw(gl_line_strip);
116116

117117
pp_def('gl_line_strip_multi',
118118
GenericTypes => $F,

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use OpenGL qw/
1616
GL_FLAT
1717
GL_LIGHTING_BIT GL_POSITION GL_LIGHTING GL_LIGHT0 GL_LIGHT_MODEL_TWO_SIDE
1818
GL_COMPILE GL_ENABLE_BIT GL_DEPTH_TEST GL_TRUE
19-
GL_LINE_STRIP GL_TRIANGLES GL_LINES
19+
GL_LINE_STRIP GL_TRIANGLES GL_LINES GL_POINTS
2020
GL_COLOR_MATERIAL GL_QUADS GL_MODELVIEW GL_PROJECTION
2121
GL_RGB GL_FLOAT GL_UNSIGNED_INT
2222
GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_TEXTURE_MAG_FILTER
@@ -168,7 +168,13 @@ sub PDL::Graphics::TriD::GObject::togl {
168168

169169
sub PDL::Graphics::TriD::Points::gdraw {
170170
my($this,$points) = @_;
171-
PDL::gl_points_col($points,$this->{Colors});
171+
glEnableClientState(GL_VERTEX_ARRAY);
172+
glVertexPointer_c(3, GL_FLOAT, 0, $points->make_physical->address_data);
173+
glEnableClientState(GL_COLOR_ARRAY);
174+
glColorPointer_c(3, GL_FLOAT, 0, $this->{Colors}->make_physical->address_data);
175+
glDrawArrays(GL_POINTS, 0, $points->nelem / $points->dim(0));
176+
glDisableClientState(GL_VERTEX_ARRAY);
177+
glDisableClientState(GL_COLOR_ARRAY);
172178
}
173179

174180
sub PDL::Graphics::TriD::Spheres::gdraw {

0 commit comments

Comments
 (0)