2003-2004 Silicon Graphics, Inc.
glGetMaterial 3G
glGetMaterial glGetMaterialfv glGetMaterialxv return material parameters values

## C Specification

void `glGetMaterialfv` GLenum face GLenum pname GLfloat * params void `glGetMaterialxv` GLenum face GLenum pname GLfixed * params

## Parameters

face

  Specifies which of the two materials is being queried. `GL_FRONT` or `GL_BACK` are accepted, representing the front and back materials, respectively.

pname

  Specifies the material parameter to return. Accepted symbolic names are `GL_AMBIENT`, `GL_DIFFUSE`, `GL_SPECULAR`, `GL_EMISSION`, and `GL_SHININESS`.

params

  Returns the requested data.

## Description

`glGetMaterial` returns in params the value or values of parameter pname of material face.

Five parameters are defined:

`GL_AMBIENT`

  params returns four fixed-point or floating-point values that specify the ambient RGBA reflectance of the material. The values are not clamped. The initial ambient reflectance is (0.2, 0.2, 0.2, 1.0).

`GL_DIFFUSE`

  params returns four fixed-point or floating-point values that specify the diffuse RGBA reflectance of the material. The values are not clamped. The initial diffuse reflectance is (0.8, 0.8, 0.8, 1.0).

`GL_SPECULAR`

  params returns four fixed-point or floating-point values that specify the specular RGBA reflectance of the material. The values are not clamped. The initial specular reflectance is (0, 0, 0, 1).

`GL_EMISSION`

  params returns four fixed-point or floating-point values that specify the RGBA emitted light intensity of the material. The values are not clamped. The initial emission intensity is (0, 0, 0, 1).

`GL_SHININESS`

  params returns a single fixed-point or floating-point value that specifies the RGBA specular exponent of the material. The initial specular exponent is 0.

## Notes

If an error is generated, no change is made to the contents of params.

In OpenGL ES there is only one material shared by the front and back. Therefore querying `GL_FRONT` and querying `GL_BACK` will always return the same value.

## Errors

`GL_INVALID_ENUM` is generated if face or pname is not an accepted value.

## See Also

glMaterial

## Copyright

Copyright 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.