Example #1
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        transform : Transform instance
            Used to define the GLSL transform(vec4) function

        color : string
            'local', 'shared' or 'global'
        """
        if vertex is None:
            vertex = glsl.get("collections/agg-point.vert")
        if fragment is None:
            fragment = glsl.get("collections/agg-point.frag")

        RawPointCollection.__init__(self, user_dtype=user_dtype,
                                    transform=transform,
                                    vertex=vertex, fragment=fragment, **kwargs)
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):

        base_dtype = [('position', (np.float32, 3), '!local', (0, 0, 0)),
                      ('color', (np.float32, 4), 'local', (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-triangle.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get('collections/raw-triangle.frag')

        Collection.__init__(self,
                            dtype=dtype,
                            itype=np.uint32,
                            mode="triangles",
                            vertex=vertex,
                            fragment=fragment,
                            **kwargs)
        self._programs[0].vert['transform'] = self.transform
Example #3
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [('prev',       (np.float32, 3), '!local', (0, 0, 0)),
                      ('curr',       (np.float32, 3), '!local', (0, 0, 0)),
                      ('next',       (np.float32, 3), '!local', (0, 0, 0)),
                      ('id',         (np.float32, 1), '!local', 0),
                      ('color',      (np.float32, 4), 'global', (0, 0, 0, 1)),
                      ('linewidth',  (np.float32, 1), 'global', 1),
                      ('antialias',  (np.float32, 1), 'global', 1),
                      ("viewport",   (np.float32, 4), 'global', (0, 0, 512, 512))]  # noqa
        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/agg-fast-path.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/agg-fast-path.frag')

        Collection.__init__(self, dtype=dtype, itype=None,
                            mode="triangle_strip",
                            vertex=vertex, fragment=fragment, **kwargs)

        program = self._programs[0]
        program.vert['transform'] = self.transform
Example #4
0
    def __init__(self, user_dtype=None, transform=None, vertex=None, fragment=None, **kwargs):

        base_dtype = [
            ("position", (np.float32, 3), "!local", (0, 0, 0)),
            ("color", (np.float32, 4), "local", (0, 0, 0, 1)),
        ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-triangle.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/raw-triangle.frag")

        Collection.__init__(
            self,
            dtype=dtype,
            itype=np.uint32,  # 16 for WebGL
            mode="triangles",
            vertex=vertex,
            fragment=fragment,
            **kwargs
        )

        # Set hooks if necessary
        program = self._programs[0]
        program.vert["transform"] = self.transform
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [('P0',        (np.float32, 3), '!local', (0, 0, 0)),
                      ('P1',        (np.float32, 3), '!local', (0, 0, 0)),
                      ('index',     (np.float32, 1), '!local', 0),
                      ('color',     (np.float32, 4), 'shared', (0, 0, 0, 1)),
                      ('linewidth', (np.float32, 1), 'shared', 1),
                      ('antialias', (np.float32, 1), 'shared', 1),
                      ('viewport',  (np.float32, 4), 'global', (0, 0, 512, 512))]  # noqa

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/agg-segment.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/agg-segment.frag')

        Collection.__init__(self, dtype=dtype, itype=np.uint32,
                            mode="triangles",
                            vertex=vertex, fragment=fragment, **kwargs)
        self._programs[0].vert['transform'] = self.transform
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """

        base_dtype = [
            ("position", (np.float32, 3), "!local", (0, 0, 0)),
            ("id", (np.float32, 1), "!local", 0),
            ("color", (np.float32, 4), "local", (0, 0, 0, 1)),
            ("linewidth", (np.float32, 1), "global", 1),
            ("viewport", (np.float32, 4), "global", (0, 0, 512, 512)),
        ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-path.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/raw-path.frag")

        vertex = transform + vertex
        Collection.__init__(self,
                            dtype=dtype,
                            itype=None,
                            mode="line_strip",
                            vertex=vertex,
                            fragment=fragment,
                            **kwargs)
        self._programs[0].vert["transform"] = self.transform
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [('P0',        (np.float32, 3), '!local', (0, 0, 0)),
                      ('P1',        (np.float32, 3), '!local', (0, 0, 0)),
                      ('index',     (np.float32, 1), '!local', 0),
                      ('color',     (np.float32, 4), 'shared', (0, 0, 0, 1)),
                      ('linewidth', (np.float32, 1), 'shared', 1),
                      ('antialias', (np.float32, 1), 'shared', 1),
                      ('viewport',  (np.float32, 4), 'global', (0, 0, 512, 512))]  # noqa

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/agg-segment.vert')
        if transform is None:
            transform = "vec4 transform(vec3 position) {return vec4(position,1.0);}"  # noqa
        if fragment is None:
            fragment = glsl.get('collections/agg-segment.frag')

        vertex = transform + vertex
        Collection.__init__(self, dtype=dtype, itype=np.uint32,
                            mode="triangles",
                            vertex=vertex, fragment=fragment, **kwargs)
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """
        base_dtype = [('position', (np.float32, 3), "!local", (0, 0, 0)),
                      ('size', (np.float32, 1), "global", 3.0),
                      ('color', (np.float32, 4), "global", (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-point.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/raw-point.frag")

        Collection.__init__(self,
                            dtype=dtype,
                            itype=None,
                            mode="points",
                            vertex=vertex,
                            fragment=fragment,
                            **kwargs)

        # Set hooks if necessary
        program = self._programs[0]
        program.vert['transform'] = self.transform
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """

        base_dtype = [("position", (np.float32, 3), "!local", (0, 0, 0)),
                      ("color", (np.float32, 4), "global", (0, 0, 0, 1)),
                      ("viewport", (np.float32, 4), "global", (0, 0, 512, 512))
                      ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-segment.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get('collections/raw-segment.frag')

        Collection.__init__(self,
                            dtype=dtype,
                            itype=None,
                            mode='lines',
                            vertex=vertex,
                            fragment=fragment,
                            **kwargs)
        self._programs[0].vert['transform'] = self.transform
Example #10
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """

        base_dtype = [('position', (np.float32, 3), '!local', (0, 0, 0)),
                      ('id',       (np.float32, 1), '!local', 0),
                      ('color',    (np.float32, 4), 'local', (0, 0, 0, 1)),
                      ("linewidth", (np.float32, 1), 'global', 1),
                      ("viewport", (np.float32, 4), 'global', (0, 0, 512, 512))
                      ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-path.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/raw-path.frag')

        vertex = transform + vertex
        Collection.__init__(self, dtype=dtype, itype=None, mode='line_strip',
                            vertex=vertex, fragment=fragment, **kwargs)
        self._programs[0].vert['transform'] = self.transform
Example #11
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """
        base_dtype = [('position', (np.float32, 3), "!local", (0, 0, 0)),
                      ('size',     (np.float32, 1), "global", 3.0),
                      ('color',    (np.float32, 4), "global", (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-point.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get("collections/raw-point.frag")

        Collection.__init__(self, dtype=dtype, itype=None, mode="points",
                            vertex=vertex, fragment=fragment, **kwargs)

        # Set hooks if necessary
        program = self._programs[0]
        program.vert['transform'] = self.transform
Example #12
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """

        base_dtype = [("position", (np.float32, 3), "!local", (0, 0, 0)),
                      ("color",    (np.float32, 4), "global", (0, 0, 0, 1)),
                      ("viewport", (np.float32, 4), "global", (0, 0, 512, 512))
                      ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-segment.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/raw-segment.frag')

        Collection.__init__(self, dtype=dtype, itype=None, mode='lines',
                            vertex=vertex, fragment=fragment, **kwargs)
        self._programs[0].vert['transform'] = self.transform
Example #13
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        color : string
            'local', 'shared' or 'global'
        """
        base_dtype = [('position', (np.float32, 3), "!local", (0, 0, 0)),
                      ('size',     (np.float32, 1), "global", 3.0),
                      ('color',    (np.float32, 4), "global", (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-point.vert")
        if transform is None:
            transform = "vec4 transform(vec3 position) {return vec4(position,1.0);}"  # noqa
        if fragment is None:
            fragment = glsl.get("collections/raw-point.frag")

        vertex = transform + vertex
        Collection.__init__(self, dtype=dtype, itype=None, mode="points",
                            vertex=vertex, fragment=fragment, **kwargs)
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):

        base_dtype = [('position', (np.float32, 3), '!local', (0, 0, 0)),
                      ('color',    (np.float32, 4), 'local',  (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-triangle.vert')
        if transform is None:
            transform = "vec4 transform(vec3 position) {return vec4(position,1.0);}"  # noqa
        if fragment is None:
            fragment = glsl.get('collections/raw-triangle.frag')

        vertex = transform + vertex
        Collection.__init__(self, dtype=dtype, itype=np.uint32,  # 16 for WebGL
                            mode="triangles",
                            vertex=vertex, fragment=fragment, **kwargs)
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        transform : Transform instance
            Used to define the GLSL transform(vec4) function

        color : string
            'local', 'shared' or 'global'
        """
        if vertex is None:
            vertex = glsl.get("collections/agg-point.vert")

        if fragment is None:
            fragment = glsl.get("collections/agg-point.frag")

        RawPointCollection.__init__(self,
                                    user_dtype=user_dtype,
                                    transform=transform,
                                    vertex=vertex,
                                    fragment=fragment,
                                    **kwargs)
Example #16
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):

        base_dtype = [('position', (np.float32, 3), '!local', (0, 0, 0)),
                      ('color',    (np.float32, 4), 'local', (0, 0, 0, 1))]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/raw-triangle.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/raw-triangle.frag')

        Collection.__init__(self, dtype=dtype, itype=np.uint32,
                            mode="triangles",
                            vertex=vertex, fragment=fragment, **kwargs)
        self._programs[0].vert['transform'] = self.transform
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):

        base_dtype = [
            ("position", (np.float32, 3), "!local", (0, 0, 0)),
            ("color", (np.float32, 4), "local", (0, 0, 0, 1)),
        ]

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/raw-triangle.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/raw-triangle.frag")

        Collection.__init__(
            self,
            dtype=dtype,
            itype=np.uint32,  # 16 for WebGL
            mode="triangles",
            vertex=vertex,
            fragment=fragment,
            **kwargs)

        # Set hooks if necessary
        program = self._programs[0]
        program.vert["transform"] = self.transform
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : string
            GLSL Transform code defining the vec4 transform(vec3) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [
            ("prev", (np.float32, 3), "!local", (0, 0, 0)),
            ("curr", (np.float32, 3), "!local", (0, 0, 0)),
            ("next", (np.float32, 3), "!local", (0, 0, 0)),
            ("id", (np.float32, 1), "!local", 0),
            ("color", (np.float32, 4), "global", (0, 0, 0, 1)),
            ("linewidth", (np.float32, 1), "global", 1),
            ("antialias", (np.float32, 1), "global", 1),
            ("viewport", (np.float32, 4), "global", (0, 0, 512, 512)),
        ]  # noqa
        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/agg-fast-path.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/agg-fast-path.frag")

        Collection.__init__(self,
                            dtype=dtype,
                            itype=None,
                            mode="triangle_strip",
                            vertex=vertex,
                            fragment=fragment,
                            **kwargs)

        program = self._programs[0]
        program.vert["transform"] = self.transform
Example #19
0
    def __init__(self, user_dtype=None, transform=None,
                 vertex=None, fragment=None, **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        join : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        miter_limit : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [('p0',         (np.float32, 3), '!local', (0, 0, 0)),
                      ('p1',         (np.float32, 3), '!local', (0, 0, 0)),
                      ('p2',         (np.float32, 3), '!local', (0, 0, 0)),
                      ('p3',         (np.float32, 3), '!local', (0, 0, 0)),
                      ('uv',         (np.float32, 2), '!local', (0, 0)),

                      ('caps',       (np.float32, 2), 'global', (0, 0)),
                      ('join',       (np.float32, 1), 'global', 0),
                      ('color',      (np.float32, 4), 'global', (0, 0, 0, 1)),
                      ('miter_limit', (np.float32, 1), 'global', 4),
                      ('linewidth',  (np.float32, 1), 'global', 1),
                      ('antialias',  (np.float32, 1), 'global', 1),
                      ('viewport',   (np.float32, 4), 'global', (0, 0, 512, 512))]  # noqa

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get('collections/agg-path.vert')
        if transform is None:
            transform = NullTransform()
        self.transform = transform        
        if fragment is None:
            fragment = glsl.get('collections/agg-path.frag')

        Collection.__init__(self, dtype=dtype, itype=np.uint32,  # 16 for WebGL
                            mode="triangles",
                            vertex=vertex, fragment=fragment, **kwargs)
        self._programs[0].vert['transform'] = self.transform
Example #20
0
    def __init__(self,
                 user_dtype=None,
                 transform=None,
                 vertex=None,
                 fragment=None,
                 **kwargs):
        """
        Initialize the collection.

        Parameters
        ----------

        user_dtype: list
            The base dtype can be completed (appended) by the used_dtype. It
            only make sense if user also provide vertex and/or fragment shaders

        transform : Transform instance
            Used to define the transform(vec4) function

        vertex: string
            Vertex shader code

        fragment: string
            Fragment  shader code

        caps : string
            'local', 'shared' or 'global'

        join : string
            'local', 'shared' or 'global'

        color : string
            'local', 'shared' or 'global'

        miter_limit : string
            'local', 'shared' or 'global'

        linewidth : string
            'local', 'shared' or 'global'

        antialias : string
            'local', 'shared' or 'global'
        """

        base_dtype = [
            ("p0", (np.float32, 3), "!local", (0, 0, 0)),
            ("p1", (np.float32, 3), "!local", (0, 0, 0)),
            ("p2", (np.float32, 3), "!local", (0, 0, 0)),
            ("p3", (np.float32, 3), "!local", (0, 0, 0)),
            ("uv", (np.float32, 2), "!local", (0, 0)),
            ("caps", (np.float32, 2), "global", (0, 0)),
            ("join", (np.float32, 1), "global", 0),
            ("color", (np.float32, 4), "global", (0, 0, 0, 1)),
            ("miter_limit", (np.float32, 1), "global", 4),
            ("linewidth", (np.float32, 1), "global", 1),
            ("antialias", (np.float32, 1), "global", 1),
            ("viewport", (np.float32, 4), "global", (0, 0, 512, 512)),
        ]  # noqa

        dtype = base_dtype
        if user_dtype:
            dtype.extend(user_dtype)

        if vertex is None:
            vertex = glsl.get("collections/agg-path.vert")
        if transform is None:
            transform = NullTransform()
        self.transform = transform
        if fragment is None:
            fragment = glsl.get("collections/agg-path.frag")

        Collection.__init__(
            self,
            dtype=dtype,
            itype=np.uint32,  # 16 for WebGL
            mode="triangles",
            vertex=vertex,
            fragment=fragment,
            **kwargs)
        self._programs[0].vert["transform"] = self.transform