I trying to do something really simple and failing badly.
I’m trying to draw a single textured triangle. The triangle gets drawn but is not textured. What am I doing wrong, this is driving me crazy!
Thanks…
void testApp::drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3){
triPoints[0].set(x1,y1,z1);
triPoints[1].set(x2,y2,z2);
triPoints[2].set(x3,y3,z3);
triTexPoints[0].set(0,0);
triTexPoints[1].set(1,0);
triTexPoints[2].set(1,1);
img.getTextureReference().bind();
glEnableClientState(GL_TEXTURE_COORD_ARRAY_EXT);
glTexCoordPointer(2, GL_FLOAT, sizeof(ofVec2f), &triTexPoints[0].x);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &triPoints[0].x);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
img.getTextureReference().unbind();
}