psychopy.tools.gltools.useMaterial

psychopy.tools.gltools.useMaterial(material, useTextures=True)[source]

Use a material for proceeding vertex draws.

Parameters:
  • material (Material or None) – Material descriptor to use. Default material properties are set if None is specified. This is equivalent to disabling materials.

  • useTextures (bool) – Enable textures. Textures specified in a material descriptor’s ‘texture’ attribute will be bound and their respective texture units will be enabled. Note, when disabling materials, the value of useTextures must match the previous call. If there are no textures attached to the material, useTexture will be silently ignored.

Return type:

None

Notes

  1. If a material mode has a value of None, a color with all components 0.0 will be assigned.

  2. Material colors and shininess values are accessible from shader programs after calling ‘useMaterial’. Values can be accessed via built-in ‘gl_FrontMaterial’ and ‘gl_BackMaterial’ structures (e.g. gl_FrontMaterial.diffuse).

Examples

Use a material when drawing:

useMaterial(metalMaterials.gold)
drawVAO( ... )  # all meshes drawn will be gold
useMaterial(None)  # turn off material when done

Back to top