CHAPTER 7: Well-Rendered Miscellany (^223)
static const GLfloat cubeVertices[] =
{
-0.5, 0.5, 0.5,
0.5, 0.5, 0.5,
0.5,-0.5, 0.5,
-0.5,-0.5, 0.5,
-0.5, 0.5,-0.5,
0.5, 0.5,-0.5,
0.5,-0.5,-0.5,
0.5,-0.5,-0.5,
};
static const GLubyte cubeColors[] =
{
255, 0, 0, 255,
0, 255, 0, 255,
0, 0, 0, 0,
0, 0, 255, 255,
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};
static const GLubyte tfan1[6 3] =
{
1,0,3,
1,3,2,
1,2,6,
1,6,5,
1,5,4,
1,4,0
};
static const GLubyte tfan2[6 3] =
{
7,4,5,
7,5,6,
7,6,2,
7,2,3,
7,3,0,
7,0,4
};
static float transY = 0.0;
glClearColor(0.0, 0.5, 0.7f, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); //1
//Render to the stencil first.
[self renderToStencil]; //2
singke
(singke)
#1