Change float colors to GLubyte in cubes sample
This commit is contained in:
parent
25d215dad3
commit
3b53691e4b
|
@ -28,27 +28,25 @@ bool isDrawingArrays = false;
|
||||||
bool isBlendingEnabled = true;
|
bool isBlendingEnabled = true;
|
||||||
bool isRunning = true;
|
bool isRunning = true;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float r;
|
GLubyte r;
|
||||||
float g;
|
GLubyte g;
|
||||||
float b;
|
GLubyte b;
|
||||||
float a;
|
GLubyte a;
|
||||||
} Color;
|
} Color;
|
||||||
|
|
||||||
Color colors[] =
|
Color colors[] =
|
||||||
{
|
{
|
||||||
{1.0f, 0.0f, 0.0f, 0.5f}, // red
|
{255, 0, 0, 128},
|
||||||
{0.0f, 1.0f, 0.0f, 0.5f}, // green
|
{0, 255, 0, 128},
|
||||||
{0.0f, 0.0f, 1.0f, 0.5f}, // blue
|
{0, 0, 255, 128},
|
||||||
{1.0f, 1.0f, 0.0f, 0.5f}, // yellow
|
{255, 255, 0, 128},
|
||||||
{1.0f, 0.0f, 1.0f, 0.5f}, // magenta
|
{255, 0, 255, 128},
|
||||||
{0.0f, 1.0f, 1.0f, 0.5f} // cyan
|
{0, 255, 255, 128}
|
||||||
};
|
};
|
||||||
Color faceColors[24];
|
Color faceColors[24];
|
||||||
|
|
||||||
|
|
||||||
float cubeVertices[] =
|
float cubeVertices[] =
|
||||||
{
|
{
|
||||||
// Front face
|
// Front face
|
||||||
|
@ -210,7 +208,7 @@ void renderUnitCube()
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
glVertexPointer(3, GL_FLOAT, 0, cubeVertices);
|
glVertexPointer(3, GL_FLOAT, 0, cubeVertices);
|
||||||
glColorPointer(4, GL_FLOAT, 0, faceColors);
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, faceColors);
|
||||||
|
|
||||||
if (isDrawingArrays) {
|
if (isDrawingArrays) {
|
||||||
glDrawArrays(GL_QUADS, 0, 24);
|
glDrawArrays(GL_QUADS, 0, 24);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user