Name
gl.GetMaterial -- return material parameters
Synopsis
paramsArray = gl.GetMaterial(face, pname)
Function
gl.GetMaterial() returns a table containing the value or values of parameter pname of material face. The following six parameters can be passed in pname:

#GL_AMBIENT
Returns four floating-point values representing the ambient reflectance of the material. The initial value is (0.2, 0.2, 0.2, 1.0)

#GL_DIFFUSE
Returns four floating-point values representing the diffuse reflectance of the material. The initial value is (0.8, 0.8, 0.8, 1.0).

#GL_SPECULAR
Returns four floating-point values representing the specular reflectance of the material. The initial value is (0, 0, 0, 1).

#GL_EMISSION
Returns four floating-point values representing the emitted light intensity of the material. The initial value is (0, 0, 0, 1).

#GL_SHININESS
Returns one floating-point value representing the specular exponent of the material. The initial value is 0.

#GL_COLOR_INDEXES
Returns three floating-point values representing the ambient, diffuse, and specular indices of the material. These indices are used only for color index lighting. (All the other parameters are used only for RGBA lighting.)

Please consult an OpenGL reference manual for more information.

Inputs
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 (see above for possible values)
Results
paramsArray
table containing the requested data
Errors
#GL_INVALID_ENUM is generated if face or pname is not an accepted value.

#GL_INVALID_OPERATION is generated if gl.GetMaterial() is executed between the execution of gl.Begin() and the corresponding execution of gl.End() .


Show TOC