- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cColorf Struct Reference

cColorf describes a color composed of 4 GLfloats. More...

`#include <CColor.h>`

List of all members.

## Public Member Functions
| cColorf ()
| cColorf (const GLfloat a_red, const GLfloat a_green, const GLfloat a_blue, const GLfloat a_alpha=1.0)
| ~cColorf ()
void | set (const GLfloat a_red, const GLfloat a_green, const GLfloat a_blue, const GLfloat a_alpha=1.0)
void | setMem3 (const GLfloat *a_colorRGB)
void | setMem4 (const GLfloat *a_colorRGBA)
GLfloat | operator[] (const unsigned int n) const
void | setR (const GLfloat a_red)
GLfloat | getR () const
void | setG (const GLfloat a_green)
GLfloat | getG () const
void | setB (const GLfloat a_blue)
GLfloat | getB () const
void | setA (const GLfloat a_alpha)
GLfloat | getA () const
void | render () const
const GLfloat * | pColor () const
cColorb | getColorb () const
## Public Attributes
GLfloat | m_color [4]
| Color in GLfloat format [R,G,B,A].

## Detailed Description

cColorf describes a color composed of 4 GLfloats.

## Constructor & Destructor Documentation

cColorf::cColorf | ( |  | ) | `[inline]`

Default constructor of cColorf (color defaults to opaque white)

cColorf::cColorf | ( | const GLfloat | a_red,
|  | const GLfloat | a_green,
|  | const GLfloat | a_blue,
|  | const GLfloat | a_alpha = `1.0` |
| ) |  |  | `[inline]`

Constructor of cColorf. Define a color by passing its RGBA components as parameters.

Parameters:

  | a_red | Red component
  | a_green | Green component
  | a_blue | Blue component
  | a_alpha | Alpha component

cColorf::~cColorf | ( |  | ) | `[inline]`

Destructor of cColorf.

## Member Function Documentation

void cColorf::set | ( | const GLfloat | a_red,
|  | const GLfloat | a_green,
|  | const GLfloat | a_blue,
|  | const GLfloat | a_alpha = `1.0` |
| ) |  |  | `[inline]`

Set a color by passing its RGBA components as parameters.

Parameters:

  | a_red | Red component
  | a_green | Green component
  | a_blue | Blue component
  | a_alpha | Alpha component

void cColorf::setMem3 | ( | const GLfloat * | a_colorRGB | ) | `[inline]`

Set color by copying three GLfloats from an external array, each describing one of the RGB components. Alpha is set to 1.0

Parameters:

  | a_colorRGB | Pointer to an array of type float.

void cColorf::setMem4 | ( | const GLfloat * | a_colorRGBA | ) | `[inline]`

Set color by copying four GLfloats from an external array, each describing one of the RGBA components.

Parameters:

  | a_colorRGBA | Pointer to an array of type float.

GLfloat cColorf::operator[] | ( | const unsigned int | n | ) | const`[inline]`

Access the nth component of this color (we provide both const and non-const versions so you can use this operator as an l-value or an r-value)

void cColorf::setR | ( | const GLfloat | a_red | ) | `[inline]`

Set the red component.

GLfloat cColorf::getR | ( |  | ) | const`[inline]`

Read the red component.

void cColorf::setG | ( | const GLfloat | a_green | ) | `[inline]`

Set the green component.

GLfloat cColorf::getG | ( |  | ) | const`[inline]`

Read the green component.

void cColorf::setB | ( | const GLfloat | a_blue | ) | `[inline]`

Set the blue component.

Parameters:

  | a_blue | Blue component.

GLfloat cColorf::getB | ( |  | ) | const`[inline]`

Read the blue component.

void cColorf::setA | ( | const GLfloat | a_alpha | ) | `[inline]`

Set the alpha component.

GLfloat cColorf::getA | ( |  | ) | const`[inline]`

Read the alpha component.

void cColorf::render | ( |  | ) | const`[inline]`

Render this color in OpenGL (sets it to be the currnent color)

Does not confirm that GL color-tracking is enabled

const GLfloat* cColorf::pColor | ( |  | ) | const`[inline]`

Returns a pointer to the raw color array

cColorb cColorf::getColorb | ( |  | ) | const`[inline]`

Returns this color, converted to cColorb format.

This method is the only method defined outside the class definition, to avoid a recursive referencing problem with the cColorb class.

The documentation for this struct was generated from the following file:

- chai3d/src/graphics/CColor.h