com.neovisionaries.android.opengl
Class ColorBuffer

java.lang.Object
  extended by com.neovisionaries.android.opengl.ColorBuffer

public final class ColorBuffer
extends Object

Color buffer.

Author:
Takahiko Kawasaki

Method Summary
static void clear()
          Clear the color buffer (call glClear(GL_COLOR_BUFFER_BIT)).
static boolean[] getWritable()
          Get the current writable masks of color components.
static void setClearColor(float red, float green, float blue, float alpha)
          Set a color used to clear the color buffer (glClearColor() is called).
static void setClearColor(int argb)
          Set a color used to clear the color buffer (glClearColor() is called).
static void setClearColor(int red, int green, int blue, int alpha)
          Set a color used to clear the color buffer (glClearColor() is called).
static void setWritable(boolean[] masks)
          Set color components writable.
static void setWritable(boolean red, boolean green, boolean blue, boolean alpha)
          Set color components writable (call glColorMask(red, green, blue, alpha)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setClearColor

public static void setClearColor(float red,
                                 float green,
                                 float blue,
                                 float alpha)
Set a color used to clear the color buffer (glClearColor() is called).

Parameters:
red - Red component from 0.0f to 1.0f.
green - Green component from 0.0f to 1.0f.
blue - Blue component from 0.0f to 1.0f.
alpha - Alpha component form 0.0f to 1.0f.
See Also:
glClearColor

setClearColor

public static void setClearColor(int red,
                                 int green,
                                 int blue,
                                 int alpha)
Set a color used to clear the color buffer (glClearColor() is called).

Parameters:
red - Red component from 0 to 255.
green - Green component from 0 to 255.
blue - Blue component from 0 to 255.
alpha - Alpha component from 0 to 255.

setClearColor

public static void setClearColor(int argb)
Set a color used to clear the color buffer (glClearColor() is called).

Parameters:
argb - An integer that holds alpha, red, green and blue components. The format is the same as defined by android.graphics.Color.
See Also:
android.graphics.Color

clear

public static void clear()
Clear the color buffer (call glClear(GL_COLOR_BUFFER_BIT)).

See Also:
glClear

setWritable

public static void setWritable(boolean red,
                               boolean green,
                               boolean blue,
                               boolean alpha)
Set color components writable (call glColorMask(red, green, blue, alpha)).

Parameters:
red - True to set the red component writable.
green - True to set the green component writable.
blue - True to set the blue component writable.
alpha - True to set the alpha component writable.
See Also:
glColorMask

setWritable

public static void setWritable(boolean[] masks)
Set color components writable.

This method calls setWritable(masks[0], masks[1], masks[2], masks[3]).

Parameters:
masks - A boolean array of size 4 (or more). Each element corresponds to red, green blue and alpha components from the beginning in this order respectively. True should be set to make the corresponding color component writable.
Throws:
IllegalArgumentException - The argument is null or the length of the argument is less than 4.
See Also:
setWritable(boolean red, boolean green, boolean blue, boolean alpha)

getWritable

public static boolean[] getWritable()
Get the current writable masks of color components.

Returns:
A boolean array of size 4. The values indicate whether the red, green, blue and alpha components are writable or not.
See Also:
GLESState.getColorWritemask()