Drawing many points in Python Qt with OpenGL -
what easiest , performat way of drawing many points differrent colors each?
right following:
paintgl(self): ... glbegin(gl_points) x, y, z, r, g, b in points: glcolor(r, g, b) glvertex3f(x, y, z) glend()
this gets slow ~50k points when drawing them every frame in paintgl(). want able rotate , zoom cloud.
i saw gldrawelements, gldrawarrays , heard shaders , stuff. please point me in right direction.
update2:
i found way, here is:
def init(self): ... points = np.array(points, dtype=np.float64) colors = np.array(colors, dtype=np.float64) self.count = len(points) self.vbo_points = vbo(points) self.vbo_colors = vbo(colors) def paintgl(self): ... self.vbo_points.bind() glenableclientstate(gl_vertex_array) glvertexpointer(3, gl_double, 0, self.vbo_points) self.vbo_colors.bind() glenableclientstate(gl_color_array) glcolorpointer(3, gl_double, 0, self.vbo_colors) gldrawarrays(gl_points, 0, self.count)
Comments
Post a Comment