MaterialProtocol

public protocol MaterialProtocol

The MaterialProtocol protocol exposes the methods and properties of an underlying CoglMaterial instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Material. Alternatively, use MaterialRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying CoglMaterial instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • _ptr Default implementation

    Typed pointer to the underlying CoglMaterial instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the CoglMaterial instance.

    Declaration

    Swift

    var _ptr: UnsafeMutablePointer<CoglMaterial>! { get }
  • Required Initialiser for types conforming to MaterialProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Material Record: MaterialProtocol extension (methods and fields)

  • copy() Extension method

    Creates a new material with the configuration copied from the source material.

    We would strongly advise developers to always aim to use cogl_material_copy() instead of cogl_material_new() whenever there will be any similarity between two materials. Copying a material helps Cogl keep track of a materials ancestry which we may use to help minimize GPU state changes.

    copy is deprecated: Use cogl_pipeline_copy() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func copy() -> MaterialRef!
  • get(ambient:) Extension method

    Retrieves the current ambient color for material

    get_ambient is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func get<ColorT>(ambient: ColorT) where ColorT : ColorProtocol
  • get(color:) Extension method

    Retrieves the current material color.

    get_color is deprecated: Use cogl_pipeline_get_color() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func get<ColorT>(color: ColorT) where ColorT : ColorProtocol
  • get(diffuse:) Extension method

    Retrieves the current diffuse color for material

    get_diffuse is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func get<ColorT>(diffuse: ColorT) where ColorT : ColorProtocol
  • get(emission:) Extension method

    Retrieves the materials current emission color.

    get_emission is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func get<ColorT>(emission: ColorT) where ColorT : ColorProtocol
  • Gets whether point sprite coordinate generation is enabled for this texture layer.

    get_layer_point_sprite_coords_enabled is deprecated: Use cogl_pipeline_get_layer_point_sprite_coords_enabled() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getLayerPointSpriteCoordsEnabled(layerIndex: Int) -> CoglBool
  • Returns the wrap mode for the ‘p’ coordinate of texture lookups on this layer.

    get_layer_wrap_mode_p is deprecated: Use cogl_pipeline_get_layer_wrap_mode_p() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getLayerWrapModeP(layerIndex: Int) -> CoglMaterialWrapMode
  • Returns the wrap mode for the ‘s’ coordinate of texture lookups on this layer.

    get_layer_wrap_mode_s is deprecated: Use cogl_pipeline_get_layer_wrap_mode_s() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getLayerWrapModeS(layerIndex: Int) -> CoglMaterialWrapMode
  • Returns the wrap mode for the ‘t’ coordinate of texture lookups on this layer.

    get_layer_wrap_mode_t is deprecated: Use cogl_pipeline_get_layer_wrap_mode_t() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getLayerWrapModeT(layerIndex: Int) -> CoglMaterialWrapMode
  • getLayers() Extension method

    This function lets you access a material’s internal list of layers for iteration.

    <note>You should avoid using this API if possible since it was only made public by mistake and will be deprecated when we have suitable alternative.</note>

    <note>It’s important to understand that the list returned may not remain valid if you modify the material or any of the layers in any way and so you would have to re-get the list in that situation.</note>

    Declaration

    Swift

    @inlinable
    func getLayers() -> GLib.ListRef!
  • getNLayers() Extension method

    Retrieves the number of layers defined for the given material

    get_n_layers is deprecated: Use cogl_pipeline_get_n_layers() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getNLayers() -> Int
  • getPointSize() Extension method

    Get the size of points drawn when COGL_VERTICES_MODE_POINTS is used with the vertex buffer API.

    get_point_size is deprecated: Use cogl_pipeline_get_point_size() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getPointSize() -> CFloat
  • getShininess() Extension method

    Retrieves the materials current emission color.

    get_shininess is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getShininess() -> CFloat
  • get(specular:) Extension method

    Retrieves the materials current specular color.

    get_specular is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func get<ColorT>(specular: ColorT) where ColorT : ColorProtocol
  • getUserProgram() Extension method

    Queries what user program has been associated with the given material using cogl_material_set_user_program().

    get_user_program is deprecated: Use #CoglSnippet api instead instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getUserProgram() -> CoglHandle!
  • removeLayer(layerIndex:) Extension method

    This function removes a layer from your material

    remove_layer is deprecated: Use cogl_pipeline_remove_layer() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func removeLayer(layerIndex: Int)
  • Before a primitive is blended with the framebuffer, it goes through an alpha test stage which lets you discard fragments based on the current alpha value. This function lets you change the function used to evaluate the alpha channel, and thus determine which fragments are discarded and which continue on to the blending stage.

    The default is COGL_MATERIAL_ALPHA_FUNC_ALWAYS

    set_alpha_test_function is deprecated: Use cogl_pipeline_set_alpha_test_function() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setAlphaTestFunction(alphaFunc: CoglMaterialAlphaFunc!, alphaReference: CFloat)
  • set(ambient:) Extension method

    Sets the material’s ambient color, in the standard OpenGL lighting model. The ambient color affects the overall color of the object.

    Since the diffuse color will be intense when the light hits the surface directly, the ambient will be most apparent where the light hits at a slant.

    The default value is (0.2, 0.2, 0.2, 1.0)

    set_ambient is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set<ColorT>(ambient: ColorT) where ColorT : ColorProtocol
  • setAmbientAndDiffuse(color:) Extension method

    Conveniently sets the diffuse and ambient color of material at the same time. See cogl_material_set_ambient() and cogl_material_set_diffuse().

    The default ambient color is (0.2, 0.2, 0.2, 1.0)

    The default diffuse color is (0.8, 0.8, 0.8, 1.0)

    set_ambient_and_diffuse is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setAmbientAndDiffuse<ColorT>(color: ColorT) where ColorT : ColorProtocol
  • setBlend(blendString:) Extension method

    If not already familiar; please refer <link linkend=“cogl-Blend-Strings”>here</link> for an overview of what blend strings are, and their syntax.

    Blending occurs after the alpha test function, and combines fragments with the framebuffer.

    Currently the only blend function Cogl exposes is ADD(). So any valid blend statements will be of the form:

      &lt;channel-mask&gt;=ADD(SRC_COLOR*(&lt;factor&gt;), DST_COLOR*(&lt;factor&gt;))
    

    <warning>The brackets around blend factors are currently not optional!</warning>

    This is the list of source-names usable as blend factors: <itemizedlist> <listitem><para>SRC_COLOR: The color of the in comming fragment</para></listitem> <listitem><para>DST_COLOR: The color of the framebuffer</para></listitem> <listitem><para>CONSTANT: The constant set via cogl_material_set_blend_constant()</para></listitem> </itemizedlist>

    The source names can be used according to the <link linkend=“cogl-Blend-String-syntax”>color-source and factor syntax</link>, so for example “(1-SRC_COLOR[A])” would be a valid factor, as would “(CONSTANT[RGB])”

    These can also be used as factors: <itemizedlist> <listitem>0: (0, 0, 0, 0)</listitem> <listitem>1: (1, 1, 1, 1)</listitem> <listitem>SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])</listitem> </itemizedlist>

    <note>Remember; all color components are normalized to the range [0, 1] before computing the result of blending.</note>

    <example id=“cogl-Blend-Strings-blend-unpremul”> <title>Blend Strings/1</title> <para>Blend a non-premultiplied source over a destination with premultiplied alpha:</para> <programlisting> “RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))” “A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))” </programlisting> </example>

    <example id=“cogl-Blend-Strings-blend-premul”> <title>Blend Strings/2</title> <para>Blend a premultiplied source over a destination with premultiplied alpha</para> <programlisting> “RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))” </programlisting> </example>

    The default blend string is:

       RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
    

    That gives normal alpha-blending when the calculated color for the material is in premultiplied form.

    set_blend is deprecated: Use cogl_pipeline_set_blend() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setBlend(blendString: UnsafePointer<CChar>!) throws -> CoglBool
  • When blending is setup to reference a CONSTANT blend factor then blending will depend on the constant set with this function.

    set_blend_constant is deprecated: Use cogl_pipeline_set_blend_constant() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setBlendConstant<ColorT>(constantColor: ColorT) where ColorT : ColorProtocol
  • set(color:) Extension method

    Sets the basic color of the material, used when no lighting is enabled.

    Note that if you don’t add any layers to the material then the color will be blended unmodified with the destination; the default blend expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for semi-transparent red. See cogl_color_premultiply().

    The default value is (1.0, 1.0, 1.0, 1.0)

    set_color is deprecated: Use cogl_pipeline_set_color() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set<ColorT>(color: ColorT) where ColorT : ColorProtocol
  • Sets the basic color of the material, used when no lighting is enabled.

    The default value is (1.0, 1.0, 1.0, 1.0)

    set_color4f is deprecated: Use cogl_pipeline_set_color4f() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setColor4f(red: CFloat, green: CFloat, blue: CFloat, alpha: CFloat)
  • Sets the basic color of the material, used when no lighting is enabled.

    The default value is (0xff, 0xff, 0xff, 0xff)

    set_color4ub is deprecated: Use cogl_pipeline_set_color4ub() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setColor4ub(red: UInt8, green: UInt8, blue: UInt8, alpha: UInt8)
  • set(diffuse:) Extension method

    Sets the material’s diffuse color, in the standard OpenGL lighting model. The diffuse color is most intense where the light hits the surface directly - perpendicular to the surface.

    The default value is (0.8, 0.8, 0.8, 1.0)

    set_diffuse is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set<ColorT>(diffuse: ColorT) where ColorT : ColorProtocol
  • set(emission:) Extension method

    Sets the material’s emissive color, in the standard OpenGL lighting model. It will look like the surface is a light source emitting this color.

    The default value is (0.0, 0.0, 0.0, 1.0)

    set_emission is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set<ColorT>(emission: ColorT) where ColorT : ColorProtocol
  • In addition to the standard OpenGL lighting model a Cogl material may have one or more layers comprised of textures that can be blended together in order, with a number of different texture combine modes. This function defines a new texture layer.

    The index values of multiple layers do not have to be consecutive; it is only their relative order that is important.

    <note>In the future, we may define other types of material layers, such as purely GLSL based layers.</note>

    set_layer is deprecated: Use cogl_pipeline_set_layer() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayer(layerIndex: Int, texture: CoglHandle)
  • If not already familiar; you can refer <link linkend=“cogl-Blend-Strings”>here</link> for an overview of what blend strings are and there syntax.

    These are all the functions available for texture combining: <itemizedlist> <listitem>REPLACE(arg0) = arg0</listitem> <listitem>MODULATE(arg0, arg1) = arg0 x arg1</listitem> <listitem>ADD(arg0, arg1) = arg0 + arg1</listitem> <listitem>ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5</listitem> <listitem>INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)</listitem> <listitem>SUBTRACT(arg0, arg1) = arg0 - arg1</listitem> <listitem> <programlisting> DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + (arg0[G] - 0.5)) * (arg1[G] - 0.5) + (arg0[B] - 0.5)) * (arg1[B] - 0.5)) </programlisting> </listitem> <listitem> <programlisting> DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + (arg0[G] - 0.5)) * (arg1[G] - 0.5) + (arg0[B] - 0.5)) * (arg1[B] - 0.5)) </programlisting> </listitem> </itemizedlist>

    Refer to the <link linkend=“cogl-Blend-String-syntax”>color-source syntax</link> for describing the arguments. The valid source names for texture combining are: <variablelist> <varlistentry> <term>TEXTURE</term> <listitem>Use the color from the current texture layer</listitem> </varlistentry> <varlistentry> <term>TEXTURE_0, TEXTURE_1, etc</term> <listitem>Use the color from the specified texture layer</listitem> </varlistentry> <varlistentry> <term>CONSTANT</term> <listitem>Use the color from the constant given with cogl_material_set_layer_constant()</listitem> </varlistentry> <varlistentry> <term>PRIMARY</term> <listitem>Use the color of the material as set with cogl_material_set_color()</listitem> </varlistentry> <varlistentry> <term>PREVIOUS</term> <listitem>Either use the texture color from the previous layer, or if this is layer 0, use the color of the material as set with cogl_material_set_color()</listitem> </varlistentry> </variablelist>

    <refsect2 id=“cogl-Layer-Combine-Examples”> <title>Layer Combine Examples</title> <para>This is effectively what the default blending is:</para> <informalexample><programlisting> RGBA = MODULATE (PREVIOUS, TEXTURE) </programlisting></informalexample> <para>This could be used to cross-fade between two images, using the alpha component of a constant as the interpolator. The constant color is given by calling cogl_material_set_layer_constant.</para> <informalexample><programlisting> RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A]) </programlisting></informalexample> </refsect2>

    <note>You can’t give a multiplication factor for arguments as you can with blending.</note>

    set_layer_combine is deprecated: Use cogl_pipeline_set_layer_combine() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerCombine(layerIndex: Int, blendString: UnsafePointer<CChar>!) throws -> CoglBool
  • When you are using the ‘CONSTANT’ color source in a layer combine description then you can use this function to define its value.

    set_layer_combine_constant is deprecated: Use cogl_pipeline_set_layer_combine_constant() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerCombineConstant<ColorT>(layerIndex: Int, constant: ColorT) where ColorT : ColorProtocol
  • Changes the decimation and interpolation filters used when a texture is drawn at other scales than 100%.

    set_layer_filters is deprecated: Use cogl_pipeline_set_layer_filters() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerFilters(layerIndex: Int, minFilter: CoglMaterialFilter, magFilter: CoglMaterialFilter)
  • This function lets you set a matrix that can be used to e.g. translate and rotate a single layer of a material used to fill your geometry.

    set_layer_matrix is deprecated: Use cogl_pipeline_set_layer_matrix() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerMatrix<MatrixT>(layerIndex: Int, matrix: MatrixT) where MatrixT : MatrixProtocol
  • When rendering points, if enable is true then the texture coordinates for this layer will be replaced with coordinates that vary from 0.0 to 1.0 across the primitive. The top left of the point will have the coordinates 0.0,0.0 and the bottom right will have 1.0,1.0. If enable is false then the coordinates will be fixed for the entire point.

    This function will only work if COGL_FEATURE_POINT_SPRITE is available. If the feature is not available then the function will return false and set error.

    set_layer_point_sprite_coords_enabled is deprecated: Use cogl_pipeline_set_layer_point_sprite_coords_enabled() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerPointSpriteCoordsEnabled(layerIndex: Int, enable: CoglBool) throws -> CoglBool
  • Sets the wrap mode for all three coordinates of texture lookups on this layer. This is equivalent to calling cogl_material_set_layer_wrap_mode_s(), cogl_material_set_layer_wrap_mode_t() and cogl_material_set_layer_wrap_mode_p() separately.

    set_layer_wrap_mode is deprecated: Use cogl_pipeline_set_layer_wrap_mode() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerWrapMode(layerIndex: Int, mode: CoglMaterialWrapMode)
  • Sets the wrap mode for the ‘p’ coordinate of texture lookups on this layer. ‘p’ is the third coordinate.

    set_layer_wrap_mode_p is deprecated: Use cogl_pipeline_set_layer_wrap_mode_p() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerWrapModeP(layerIndex: Int, mode: CoglMaterialWrapMode)
  • Sets the wrap mode for the ‘s’ coordinate of texture lookups on this layer.

    set_layer_wrap_mode_s is deprecated: Use cogl_pipeline_set_layer_wrap_mode_s() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerWrapModeS(layerIndex: Int, mode: CoglMaterialWrapMode)
  • Sets the wrap mode for the ‘t’ coordinate of texture lookups on this layer.

    set_layer_wrap_mode_t is deprecated: Use cogl_pipeline_set_layer_wrap_mode_t() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLayerWrapModeT(layerIndex: Int, mode: CoglMaterialWrapMode)
  • set(pointSize:) Extension method

    Changes the size of points drawn when COGL_VERTICES_MODE_POINTS is used with the vertex buffer API. Note that typically the GPU will only support a limited minimum and maximum range of point sizes. If the chosen point size is outside that range then the nearest value within that range will be used instead. The size of a point is in screen space so it will be the same regardless of any transformations. The default point size is 1.0.

    set_point_size is deprecated: Use cogl_pipeline_set_point_size() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set(pointSize: CFloat)
  • set(shininess:) Extension method

    Sets the shininess of the material, in the standard OpenGL lighting model, which determines the size of the specular highlights. A higher shininess will produce smaller highlights which makes the object appear more shiny.

    The default value is 0.0

    set_shininess is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set(shininess: CFloat)
  • set(specular:) Extension method

    Sets the material’s specular color, in the standard OpenGL lighting model. The intensity of the specular color depends on the viewport position, and is brightest along the lines of reflection.

    The default value is (0.0, 0.0, 0.0, 1.0)

    set_specular is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set<ColorT>(specular: ColorT) where ColorT : ColorProtocol
  • setUser(program:) Extension method

    Associates a linked CoglProgram with the given material so that the program can take full control of vertex and/or fragment processing.

    This is an example of how it can be used to associate an ARBfp program with a CoglMaterial:

    CoglHandle shader;
    CoglHandle program;
    CoglMaterial *material;
    
    shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
    cogl_shader_source (shader,
                        "!!ARBfp1.0\n"
                        "MOV result.color,fragment.color;\n"
                        "END\n");
    cogl_shader_compile (shader);
    
    program = cogl_create_program ();
    cogl_program_attach_shader (program, shader);
    cogl_program_link (program);
    
    material = cogl_material_new ();
    cogl_material_set_user_program (material, program);
    
    cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
    cogl_rectangle (0, 0, 100, 100);
    

    It is possibly worth keeping in mind that this API is not part of the long term design for how we want to expose shaders to Cogl developers (We are planning on deprecating the cogl_program and cogl_shader APIs in favour of a “snippet” framework) but in the meantime we hope this will handle most practical GLSL and ARBfp requirements.

    Also remember you need to check for either the COGL_FEATURE_SHADERS_GLSL or COGL_FEATURE_SHADERS_ARBFP before using the cogl_program or cogl_shader API.

    set_user_program is deprecated: Use #CoglSnippet api instead instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setUser(program: CoglHandle)
  • layers Extension method

    This function lets you access a material’s internal list of layers for iteration.

    <note>You should avoid using this API if possible since it was only made public by mistake and will be deprecated when we have suitable alternative.</note>

    <note>It’s important to understand that the list returned may not remain valid if you modify the material or any of the layers in any way and so you would have to re-get the list in that situation.</note>

    Declaration

    Swift

    @inlinable
    var layers: GLib.ListRef! { get }
  • nLayers Extension method

    Retrieves the number of layers defined for the given material

    get_n_layers is deprecated: Use cogl_pipeline_get_n_layers() instead

    Declaration

    Swift

    @inlinable
    var nLayers: Int { get }
  • pointSize Extension method

    Get the size of points drawn when COGL_VERTICES_MODE_POINTS is used with the vertex buffer API.

    get_point_size is deprecated: Use cogl_pipeline_get_point_size() instead

    Declaration

    Swift

    @inlinable
    var pointSize: CFloat { get nonmutating set }
  • shininess Extension method

    Retrieves the materials current emission color.

    get_shininess is deprecated: Use the #CoglSnippet shader api for lighting

    Declaration

    Swift

    @inlinable
    var shininess: CFloat { get nonmutating set }
  • userProgram Extension method

    Queries what user program has been associated with the given material using cogl_material_set_user_program().

    get_user_program is deprecated: Use #CoglSnippet api instead instead

    Declaration

    Swift

    @inlinable
    var userProgram: CoglHandle! { get nonmutating set }