//我不知道这个,任何人都可以帮助我 //纹理类型是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);
答案 0 :(得分: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等价物。我希望它能帮助你完成“翻译”。