Skip to content

Markers

Markers

Markers(
    positions: Transform | Buffer,
    types: Transform | Buffer | Marker,
    sizes: Transform | Buffer | float,
    axis: Transform | Buffer | Vec3,
    angles: Transform | Buffer | float,
    fill_colors: Transform | Buffer | Color,
    line_colors: Transform | Buffer | Color,
    line_widths: Transform | Buffer | float,
)

Markers are arbitrary shapes with a given type, size and orientation that posses a surface that can be filled and stroked.

IN/OUT variables
// Rendering stage 1
in uniform vec4 viewport;                    // in("viewport")
in attribute [ vec2 | vec3 ] positions;      // in("positions")
in [ attribute | uniform ] int types;        // in("types")
in [ attribute | uniform ] float sizes;      // in("sizes")
in [ attribute | uniform ] vec3 axis;        // in("axis")
in [ attribute | uniform ] vec3 angles;      // in("angles")
in [ attribute | uniform ] vec4 fill_colors; // in("fill_colors")
in [ attribute | uniform ] vec4 line_colors; // in("line_colors")
in [ attribute | uniform ] vec4 line_widths; // in("line_widths")

// Rendering stage 2
out attribute vec3 screen;              // out("screen[positions]")

// Rendering stage 3
out attribute int types;               // out("types")
out attribute float sizes;             // out("sizes")
out attribute vec3 axis;               // out("axis")
out attribute vec3 angles;             // out("angles")
out attribute vec4 fill_colors;        // out("fill_colors")
out attribute vec4 line_colors;        // out("line_colors")
out attribute float line_widths;       // out("line_widths")
Example
positions = core.Buffer(3, np.dtype(np.float32))
sizes =  core.Buffer(3, np.dtype(np.float32))
markers = visual.Markers(positions,
                         types=core.Marker.star,
                         sizes=sizes,
                         axis=None,
                         angles=0.0,
                         fill_colors=(0,0,0,1),
                         line_colors=(0,0,0,0),
                         line_widths=0.0)
1. COMMAND
     - METHOD: "core.Buffer" (str)
     - COMMAND_ID: 1 (int)
     - TIMESTAMP: 2025-03-18T15:02:33.806392 (datetime)
   PARAMETERS
     - OBJECT_ID: 1 (int)
     - COUNT: 3 (int)
     - DTYPE: float32 (dtype)
     - DATA: None (memoryview | bytes)

2. COMMAND
     - METHOD: "core.Buffer" (str)
     - COMMAND_ID: 2 (int)
     - TIMESTAMP: 2025-03-18T15:02:33.806478 (datetime)
   PARAMETERS
     - OBJECT_ID: 2 (int)
     - COUNT: 3 (int)
     - DTYPE: float32 (dtype)
     - DATA: None (memoryview | bytes)

3. COMMAND
     - METHOD: "visual.Markers" (str)
     - COMMAND_ID: 3 (int)
     - TIMESTAMP: 2025-03-18T15:02:33.806585 (datetime)
   PARAMETERS
     - OBJECT_ID: 3 (int)
     - POSITIONS_ID: 1 (Transform | Buffer)
     - TYPES: 7 (Transform | Buffer | Marker)
     - SIZES_ID: 2 (Transform | Buffer | float)
     - AXIS: None (Transform | Buffer | Vec3)
     - ANGLES: 0.0 (Transform | Buffer | float)
     - FILL_COLORS: Color(r=0, g=0, b=0, a=1) (converted) (Transform | Buffer | Color)
     - LINE_COLORS: Color(r=0, g=0, b=0, a=0) (converted) (Transform | Buffer | Color)
     - LINE_WIDTHS: 0.0 (Transform | Buffer | float)

{
  "jsonrpc": "2.0",
  "commands": [
    {
      "method": "core.Buffer",
      "id": 1,
      "timestamp": 1742306553.806392,
      "parameters": {
        "id": 1,
        "count": 3,
        "dtype": "float32",
        "data": null
      }
    },
    {
      "method": "core.Buffer",
      "id": 2,
      "timestamp": 1742306553.806478,
      "parameters": {
        "id": 2,
        "count": 3,
        "dtype": "float32",
        "data": null
      }
    },
    {
      "method": "visual.Markers",
      "id": 3,
      "timestamp": 1742306553.806585,
      "parameters": {
        "id": 3,
        "positions(id)": 1,
        "types": 7,
        "sizes(id)": 2,
        "axis": null,
        "angles": 0.0,
        "fill_colors": [
          0,
          0,
          0,
          1
        ],
        "line_colors": [
          0,
          0,
          0,
          0
        ],
        "line_widths": 0.0
      }
    }
  ]
}

Create a visual of n points at given positions with given sizes, flll_colors., line_colors and line_widths.

Parameters:

Name Type Description Default
positions Transform | Buffer

Points position (vec3)

required
types Transform | Buffer | Marker

Marker types (Marker)

required
sizes Transform | Buffer | Measure

Point sizes (float)

required
axis Transform | Buffer | Vec3

Marker axis (vec3)

required
angles Transform | Buffer | float

Marker rotation angle around axis (float)

required
fill_colors Transform | Buffer | Color

Points fill colors (vec4)

required
line_colors Transform | Buffer | Color

Points line colors (vec4)

required
line_widths Transform | Buffer | Measure

Points line colors (vec4)

required

render

render(
    viewport: Viewport,
    model: Matrix = None,
    view: Matrix = None,
    proj: Matrix = None,
)

Render the visual on viewport using the given model, view, proj matrices

Parameters:

Name Type Description Default
viewport Viewport

Viewport where to render the visual

required
model Matrix

Model matrix to use for rendering

None
view Matrix

View matrix to use for rendering

None
proj Matrix

Projection matrix to use for rendering

None