gi-cogl-1.0.3: COGL GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Cogl.Structs.Material

Description

No description available in the introspection data.

Synopsis

Exported types

newtype Material Source #

Memory-managed wrapper type.

Constructors

Material (ManagedPtr Material) 

Instances

Instances details
Eq Material Source # 
Instance details

Defined in GI.Cogl.Structs.Material

BoxedPtr Material Source # 
Instance details

Defined in GI.Cogl.Structs.Material

ManagedPtrNewtype Material Source # 
Instance details

Defined in GI.Cogl.Structs.Material

Methods

toManagedPtr :: Material -> ManagedPtr Material

Methods

getAmbient

materialGetAmbient Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

ambient: The location to store the ambient color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Retrieves the current ambient color for material

Since: 1.0

getColor

materialGetColor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> m Color 

Deprecated: (Since version 1.16)Use cogl_pipeline_get_color() instead

Retrieves the current material color.

Since: 1.0

getDiffuse

materialGetDiffuse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

diffuse: The location to store the diffuse color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Retrieves the current diffuse color for material

Since: 1.0

getEmission

materialGetEmission Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

emission: The location to store the emission color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Retrieves the materials current emission color.

Since: 1.0

getLayerPointSpriteCoordsEnabled

materialGetLayerPointSpriteCoordsEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a CoglHandle to a material.

-> Int32

layerIndex: the layer number to check.

-> m Int32

Returns: whether the texture coordinates will be replaced with point sprite coordinates.

Deprecated: (Since version 1.16)Use cogl_pipeline_get_layer_point_sprite_coords_enabled() instead

Gets whether point sprite coordinate generation is enabled for this texture layer.

Since: 1.4

getLayerWrapModeP

materialGetLayerWrapModeP Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> m MaterialWrapMode

Returns: the wrap mode for the 'p' coordinate of texture lookups on this layer.

Deprecated: (Since version 1.16)Use cogl_pipeline_get_layer_wrap_mode_p() instead

Returns the wrap mode for the 'p' coordinate of texture lookups on this layer.

Since: 1.6

getLayerWrapModeS

materialGetLayerWrapModeS Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> m MaterialWrapMode

Returns: the wrap mode for the 's' coordinate of texture lookups on this layer.

Deprecated: (Since version 1.16)Use cogl_pipeline_get_layer_wrap_mode_s() instead

Returns the wrap mode for the 's' coordinate of texture lookups on this layer.

Since: 1.6

getLayerWrapModeT

materialGetLayerWrapModeT Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> m MaterialWrapMode

Returns: the wrap mode for the 't' coordinate of texture lookups on this layer.

Deprecated: (Since version 1.16)Use cogl_pipeline_get_layer_wrap_mode_t() instead

Returns the wrap mode for the 't' coordinate of texture lookups on this layer.

Since: 1.6

getLayers

materialGetLayers Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> m [MaterialLayer]

Returns: A list of MaterialLayer's that can be passed to the cogl_material_layer_* functions. The list is owned by Cogl and it should not be modified or freed Deprecated: 1.16: Use cogl_pipeline_get_layers() instead

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>

getNLayers

materialGetNLayers Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> m Int32

Returns: the number of layers

Deprecated: (Since version 1.16)Use cogl_pipeline_get_n_layers() instead

Retrieves the number of layers defined for the given material

Since: 1.0

getPointSize

materialGetPointSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a CoglHandle to a material.

-> m Float

Returns: the point size of the material.

Deprecated: (Since version 1.16)Use cogl_pipeline_get_point_size() instead

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

Since: 1.4

getShininess

materialGetShininess Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> m Float

Returns: The materials current shininess value

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Retrieves the materials current emission color.

Since: 1.0

getSpecular

materialGetSpecular Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

specular: The location to store the specular color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Retrieves the materials current specular color.

Since: 1.0

getUserProgram

materialGetUserProgram Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a Material object.

-> m (Ptr ())

Returns: The current user program or COGL_INVALID_HANDLE.

Deprecated: (Since version 1.16)Use CoglSnippet api instead instead

Queries what user program has been associated with the given material using materialSetUserProgram.

Since: 1.4

ref

materialRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

material: a Material object.

-> m (Ptr ())

Returns: the material.

Deprecated: (Since version 1.2)Use cogl_object_ref() instead

Increment the reference count for a Material.

Since: 1.0

removeLayer

materialRemoveLayer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: Specifies the layer you want to remove

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_remove_layer() instead

This function removes a layer from your material

setAlphaTestFunction

materialSetAlphaTestFunction Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> MaterialAlphaFunc

alphaFunc: A coglMaterialAlphaFunc constant

-> Float

alphaReference: A reference point that the chosen alpha function uses to compare incoming fragments to.

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_alpha_test_function() instead

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 MaterialAlphaFuncAlways

Since: 1.0

setAmbient

materialSetAmbient Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

ambient: The components of the desired ambient color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

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)

Since: 1.0

setAmbientAndDiffuse

materialSetAmbientAndDiffuse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

color: The components of the desired ambient and diffuse colors

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

Conveniently sets the diffuse and ambient color of material at the same time. See materialSetAmbient and materialSetDiffuse.

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)

Since: 1.0

setBlend

materialSetBlend Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Text

blendString: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired blend function.

-> m Int32

Returns: True if the blend string was successfully parsed, and the described blending is supported by the underlying driver/hardware. If there was an error, False is returned and error is set accordingly (if present). (Can throw GError)

Deprecated: (Since version 1.16)Use cogl_pipeline_set_blend() instead

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 materialSetBlendConstant</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.

Since: 1.0

setBlendConstant

materialSetBlendConstant Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

constantColor: The constant color you want

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_blend_constant() instead

When blending is setup to reference a CONSTANT blend factor then blending will depend on the constant set with this function.

Since: 1.0

setColor

materialSetColor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

color: The components of the color

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_color() instead

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 colorPremultiply.

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

Since: 1.0

setColor4f

materialSetColor4f Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Float

red: The red component

-> Float

green: The green component

-> Float

blue: The blue component

-> Float

alpha: The alpha component

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_color4f() instead

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)

Since: 1.0

setColor4ub

materialSetColor4ub Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Word8

red: The red component

-> Word8

green: The green component

-> Word8

blue: The blue component

-> Word8

alpha: The alpha component

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_color4ub() instead

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

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

Since: 1.0

setDiffuse

materialSetDiffuse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

diffuse: The components of the desired diffuse color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

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)

Since: 1.0

setEmission

materialSetEmission Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

emission: The components of the desired emissive color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

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)

Since: 1.0

setLayer

materialSetLayer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the index of the layer

-> Ptr ()

texture: a CoglHandle for the layer object

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer() instead

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>

Since: 1.0

setLayerCombine

materialSetLayerCombine Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: Specifies the layer you want define a combine function for

-> Text

blendString: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired texture combine function.

-> m Int32

Returns: True if the blend string was successfully parsed, and the described texture combining is supported by the underlying driver and or hardware. On failure, False is returned and error is set (Can throw GError)

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_combine() instead

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 materialSetColor</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 materialSetColor</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>

Since: 1.0

setLayerCombineConstant

materialSetLayerCombineConstant Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: Specifies the layer you want to specify a constant used for texture combining

-> Color

constant: The constant color you want

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_combine_constant()instead

When you are using the 'CONSTANT' color source in a layer combine description then you can use this function to define its value.

Since: 1.0

setLayerFilters

materialSetLayerFilters Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> MaterialFilter

minFilter: the filter used when scaling a texture down.

-> MaterialFilter

magFilter: the filter used when magnifying a texture.

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_filters() instead

Changes the decimation and interpolation filters used when a texture is drawn at other scales than 100%.

setLayerMatrix

materialSetLayerMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the index for the layer inside material

-> Matrix

matrix: the transformation matrix for the layer

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_matrix() instead

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.

setLayerPointSpriteCoordsEnabled

materialSetLayerPointSpriteCoordsEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a CoglHandle to a material.

-> Int32

layerIndex: the layer number to change.

-> Int32

enable: whether to enable point sprite coord generation.

-> m Int32

Returns: True if the function succeeds, False otherwise. (Can throw GError)

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_point_sprite_coords_enabled() instead

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 FeatureFlagsPointSprite is available. If the feature is not available then the function will return False and set error.

Since: 1.4

setLayerWrapMode

materialSetLayerWrapMode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> MaterialWrapMode

mode: the new wrap mode

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_wrap_mode() instead

Sets the wrap mode for all three coordinates of texture lookups on this layer. This is equivalent to calling materialSetLayerWrapModeS, materialSetLayerWrapModeT and materialSetLayerWrapModeP separately.

Since: 1.4

setLayerWrapModeP

materialSetLayerWrapModeP Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> MaterialWrapMode

mode: the new wrap mode

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_wrap_mode_p() instead

Sets the wrap mode for the 'p' coordinate of texture lookups on this layer. 'p' is the third coordinate.

Since: 1.4

setLayerWrapModeS

materialSetLayerWrapModeS Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> MaterialWrapMode

mode: the new wrap mode

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_wrap_mode_s() instead

Sets the wrap mode for the 's' coordinate of texture lookups on this layer.

Since: 1.4

setLayerWrapModeT

materialSetLayerWrapModeT Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Int32

layerIndex: the layer number to change.

-> MaterialWrapMode

mode: the new wrap mode

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_layer_wrap_mode_t() instead

Sets the wrap mode for the 't' coordinate of texture lookups on this layer.

Since: 1.4

setPointSize

materialSetPointSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a material.

-> Float

pointSize: the new point size.

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_point_size() instead

Changes the size of points drawn when VerticesModePoints 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.

Since: 1.4

setShininess

materialSetShininess Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Float

shininess: The desired shininess; must be >= 0.0

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

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

Since: 1.0

setSpecular

materialSetSpecular Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: A Material object

-> Color

specular: The components of the desired specular color

-> m () 

Deprecated: (Since version 1.16)Use the CoglSnippet shader api for lighting

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)

Since: 1.0

setUserProgram

materialSetUserProgram Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Material

material: a Material object.

-> Ptr ()

program: A CoglHandle to a linked CoglProgram

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead instead

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 Material: > >CoglHandle shader; >CoglHandle program; >CoglMaterial *material; > >shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); >cogl_shader_source (shader, > "!!ARBfp1.0n" > "MOV result.color,fragment.color;n" > "ENDn"); >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 FeatureFlagsShadersGlsl or FeatureFlagsShadersArbfp before using the cogl_program or cogl_shader API.

Since: 1.4

unref

materialUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

material: a Material object.

-> m () 

Deprecated: (Since version 1.2)Use cogl_object_unref() instead

Decrement the reference count for a Material.

Since: 1.0