def draw(self): """ Draw the vertex array as points. """ self.bind() GL.glDrawArrays(GL.GL_POINTS, 0, self._number_of_items) self.unbind()
def draw(self): """ Draw the vertex array as lines. """ if self._number_of_objects >= 2: self.bind() GL.glDrawArrays(GL.GL_LINES, 0, self._number_of_objects) self.unbind()
def draw(self): """ Draw the vertex array as lines. """ if self._number_of_objects >= 2: self.bind() GL.glDrawArrays(GL.GL_LINE_STRIP_ADJACENCY, 0, self._number_of_objects +2) self.unbind()
def draw(self, shader_program): # Freetype renders glyph as grayscale: white foreground on black background # If the LCD filter is enabled then the pixels on border are coloured. # black fragment should be discarded # # Blending equation for transparency: # O = (1-Sa)*D + Sa*S # if Sa = 1 then O = S overwrite # = 0 then O = D keep the value # # Grayscale case: # S = luminosity * colour grayscale = luminosity # Sa = average luminosity * alpha ??? # # LCD case: # white -> red : (1,1,1) -> (1,0,0) # Blending: O = Sf*S + Df*D # where S is the colour from the fragment shader and D the colour from the framebuffer # alpha: fully transparent = 0 and fully opaque = 1 # Sa = average luminosity * colour aplha # # Set (Sf, Df) for transparency: O = Sa*S + (1-Sa)*D GL.glEnable(GL.GL_BLEND) GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) shader_program.bind() self._image_texture.bind() self.bind() shader_program.uniforms.font_atlas = 0 # shader_program.uniforms.gamma = 1. GL.glDrawArrays(GL.GL_POINTS, 0, self._number_of_items) self.unbind() self._image_texture.unbind() shader_program.unbind() GL.glDisable(GL.GL_BLEND)
def draw(self): self.bind() GL.glDrawArrays(GL.GL_POINTS, 0, self._number_of_items) self.unbind()