Sorry about the basic question.
I’m following this article (http://openframeworks.cc/tutorials/graphics/opengl.html), but I’m having problems with texture mapping. Probably I’m failing to grasp some basic principle.
I’m using oF 0.8.3 for iOS.
All I can see is a black rectangle not mapped with the texture.
void MyOfApp::setup()
{
ofBackground(200);
ofSetFrameRate(60);
ofSetBackgroundAuto(true);
string imageFileName = "IMG_type.jpg"; // RGB, 600 × 450
ofLoadImage(texture, imageFileName); // instance of "ofTexture"
ofPlanePrimitive plane;
plane.set(500, 300, 2, 2);
plane.mapTexCoords(0, 0, 500, 300);
mesh = plane.getMesh(); // mesh is instance of "ofMesh"
}
void MyOfApp::draw()
{
ofEnableDepthTest();
ofBackground(255, 255, 255);
ofPushMatrix();
float time = ofGetElapsedTimef();
float angle = time * 90;
ofTranslate( ofGetWidth()/2, ofGetHeight()/2, 0 );
ofRotate( angle, 0, 1, 0 );
ofSetColor( 255, 255, 255 );
texture.bind();
mesh.draw();
texture.unbind();
ofPopMatrix();
}
Thanks.