Gambas Documentation - /comp/gb.opengl/gl/color4i

/comp/gb.opengl/gl/color4i

# Gl.Color4i (gb.opengl)

Static Sub Color4i ( Red As Integer, Green As Integer, Blue As Integer, Alpha As Integer )

Set the current color.

### Parameters

red, green, blue

  Specify new red, green, and blue values for the current color.

alpha

  Specifies a new alpha value for the current color. Included only in the four-argument Gl.Color4 commands.

### Parameters

v

  Specifies a pointer to an array that contains red, green, blue, and (sometimes) alpha values.

### Description

The GL stores both a current single-valued color index and a current four-valued RGBA color. Gl.Color sets a new four-valued RGBA color. Gl.Color has two major variants: Gl.Color3 and Gl.Color4. Gl.Color3 variants specify new red, green, and blue values explicitly and set the current alpha value to 1.0 (full intensity) implicitly. Gl.Color4 variants specify all four color components explicitly.

Gl.Color3b, Gl.Color4b, Gl.Color3s, Gl.Color4s, Gl.Color3i, and Gl.Color4i take three or four signed byte, short, or long integers as arguments. When v is appended to the name, the color commands can take a pointer to an array of such values.

Current color values are stored in floating-point format, with unspecified mantissa and exponent sizes. Unsigned integer color components, when specified, are linearly mapped to floating-point values such that the largest representable value maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity). Signed integer color components, when specified, are linearly mapped to floating-point values such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0 . (Note that this mapping does not convert 0 precisely to 0.0.) Floating-point values are mapped directly.

Neither floating-point nor signed integer values are clamped to the range 0 1 before the current color is updated. However, color components are clamped to this range before they are interpolated or written into a color buffer.

### Notes

The initial value for the current color is (1, 1, 1, 1).

The current color can be updated at any time. In particular, Gl.Color can be called between a call to Gl.Begin and the corresponding call to Gl.End.

### Associated Gets

Gl.Get with argument Gl.CURRENT_COLOR

Gl.Get with argument Gl.RGBA_MODE

### See also

Gl.ColorPointer, Gl.Index, Gl.SecondaryColor

See original documentation on OpenGL website