0
J'écris pour iPhone, OpenGL ESCouper une partie de la texture
Savez-vous comment puis-je dessiner quad avec une partie de texture particulière?
Maintenant, je suis rendu comme ça:
static const GLfloat texCoords[] = {
0.0, 0.0,
10.0, 0.0,
10.0, 10.0,
0.0, 10.0
};
glBindTexture(GL_TEXTURE_2D, atlas_tex[0]);
GLfloat squareVertices[] = {
0.0f, 0.0f,
2000.5f, 0.0f,
2000.5f, 2000.33f,
0.0f, 2000.33f
};
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
Mais bien sûr, il afficher toutes les textures. Je ne sais pas comment le couper.