这是我的问题。我正在使用 GL_TRIANGLE_STRIP 绘制一个框。不涉及纹理,没有材质,也没有着色器。我只是在渲染彩色三角形。
你可以在这里看到它的样子:失败框
但正如你所看到的,我有一些明显的褪色问题。也没有激活照明。
这里是我用来初始化和渲染盒子的代码。
//here init code
for(list<Particle*>::iterator p = this->shapes[this->activeShape].particles.begin();
p != this->shapes[this->activeShape].particles.end(); p++)
{
float yValue = 20.0f;
this->vertexArray[this->activeShape][current].Position.x = (*p)->x0.x;
this->vertexArray[this->activeShape][current].Position.y = -yValue;
this->vertexArray[this->activeShape][current].Position.z = (*p)->x0.y;
this->vertexArray[this->activeShape][current + listSize].Position.x = (*p)->x0.x;
this->vertexArray[this->activeShape][current + listSize].Position.y = yValue;
this->vertexArray[this->activeShape][current + listSize].Position.z = (*p)->x0.y;
current++;
}
// render code
glFrontFace(GL_CW);
glEnable(GL_BLEND);
glVertexPointer(3, GL_FLOAT, sizeof(LsmVertexColor), &this->vertexArray[this->activeShape][0].Position);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(SCULPTY_R, SCULPTY_G, SCULPTY_B, SCULPTY_A);
glDrawElements(GL_TRIANGLE_STRIP, 20, GL_UNSIGNED_SHORT, &this->indexArray[this->activeShape][0]);
glDrawElements(GL_TRIANGLE_STRIP, 20, GL_UNSIGNED_SHORT, &this->indexArray[this->activeShape][22]);
glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_SHORT, &this->indexArray[this->activeShape][44]);
glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_SHORT, &this->indexArray[this->activeShape][54]);
我正在使用 OpenGL ES 1.1(我知道我不是最新的)并且该程序正在 iPhone/iPad 上运行。