0

//我对此一无所知,谁能帮帮我//纹理类型是CCTexture2D,_Vertices类型是CGPoint*,_Coords类型是CGPoint*

glBindTexture(GL_TEXTURE_2D, texture.name);
glDisableClientState(GL_COLOR_ARRAY);

glColor4f(1, 1, 1, 1);
glVertexPointer(2, GL_FLOAT, 0, _Vertices);
glTexCoordPointer(2, GL_FLOAT, 0, _Coords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nVertices);

glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
4

1 回答 1

0
glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texture.name); glUniform1i(/*insert texture uniform*/0, 1);
glDisableVertexAttribArray(GLKVertexAttribColor);

glUniform4f(/*insert color uniform*/0, 1, 1, 1, 1);
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, 0, _Vertices);
glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, _Coords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nVertices);

//glDisable(GL_TEXTURE_2D);
glDisableVertexAttribArray(GLKVertexAttribColor);
glDisableVertexAttribArray(GLKVertexAttribTexCoord0);

//glEnable(GL_TEXTURE_2D);
glEnableVertexAttribArray(GLKVertexAttribColor);
glEnableVertexAttribArray(GLKVertexAttribTexCoord0);

这应该或多或少相当于 ES2。我希望它能帮助你完成“翻译”。

于 2013-04-09T07:05:06.160 回答