GLOW API version 1.0 reference

Back to
Table of contents


class GlowColor

General information

type: class
inherits: (none)
module: glowAux

GlowColor encapsulates a GLOW RGB color specification. It is used heavily in widgets to specify colors for different widget parts.

Any GLOW program that handles widgets may need to use GlowColor objects. They are also generally useful for drawing normal GLOW components.

Constants

Useful colors
These are a few generally useful colors.

static const GlowColor black
static const GlowColor blue
static const GlowColor green
static const GlowColor cyan
static const GlowColor red
static const GlowColor magenta
static const GlowColor yellow
static const GlowColor white
static const GlowColor gray

Methods

Constructors and setters

explicit GlowColor(GLubyte rgbval = 0, GLubyte aval = 255)

Creates a new grayscale color using the given integer rgb and alpha values in the range [0,255].

explicit GlowColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255)

Creates a new color using the given integer rgb and alpha values in the range [0,255].

explicit GlowColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f)

Creates a new color using the given single-precision floating point rgb and alpha values in the range [0,1].

explicit GlowColor(GLdouble r, GLdouble g, GLdouble b, GLdouble a = 1.0)

Creates a new color using the given double-precision floating point rgb and alpha values in the range [0,1].

void Set(GLubyte rgbval = 0, GLubyte aval = 255)

Sets a grayscale color using the given integer rgb and alpha values in the range [0,255].

void Set(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255)

Sets a color using the given integer rgb and alpha values in the range [0,255].

void Set(GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f)

Sets a color using the given single-precision floating point rgb and alpha values in the range [0,1].

void Set(GLdouble r, GLdouble g, GLdouble b, GLdouble a = 1.0)

Sets a color using the given double-precision floating point rgb and alpha values in the range [0,1].

Conversions and accessors
These methods and operators allow provide access to color data, and also convert to unsigned char* for use in OpenGL functions.

operator GLubyte*(void)

Converts to GLubyte*. The result may be used in glColor4ubv() for example.

operator const GLubyte*(void) const

Converts to const GLubyte*. The result may be used in glColor4ubv() for example.

GLubyte& operator[](int index)

Access to color values via array syntax. Index 0 is red, 3 is alpha.

const GLubyte& operator[](int index) const

Access to color values via array syntax. Index 0 is red, 3 is alpha.

Other convenience methods

void Apply(void)

Calls glColor with this color.

Back to
Table of contents


The GLOW Toolkit