Exemplo n.º 1
0
    def __init__(self, shaderGlobals):
        """
        @param shaderGlobals: the instance of class ShaderGlobals
            we will be associated with.
        """
        super(GLCylinderBuffer, self).__init__(shaderGlobals)

        # Per-vertex attribute hunk VBOs that are specific to the cylinder
        # shader.  Combine endpoints and radii into two vec4's.  It would be
        # nicer to use a twice-4-element mat2x4 attribute VBO, but it would have
        # to be sent as two attribute slots anyway, because OpenGL only allows
        # "size" to be 1 to 4 in glVertexAttribPointer.
        shader = self.shader
        self.endptRad0Hunks = HunkBuffer(shader, "endpt_rad_0", self.nVertices,
                                         4)
        self.endptRad1Hunks = HunkBuffer(shader, "endpt_rad_1", self.nVertices,
                                         4)
        self.hunkBuffers += [self.endptRad0Hunks, self.endptRad1Hunks]

        return
Exemplo n.º 2
0
    def __init__(self, shaderGlobals):
        """
        @param shaderGlobals: the instance of class ShaderGlobals
            we will be associated with.
        """
        super(GLSphereBuffer, self).__init__(shaderGlobals)

        # Per-vertex attribute hunk VBOs that are specific to the sphere shader.
        # Combine centers and radii into a 4-element vec4 attribute VBO.  (Each
        # attribute slot takes 4 floats, no matter how many of them are used.)
        shader = self.shader
        self.ctrRadHunks = HunkBuffer(shader, "center_rad", self.nVertices, 4)
        self.hunkBuffers += [self.ctrRadHunks]

        return