@davidemania wrote:
In the process of porting my code to the Raspberry Pi I am having trouble with how the mesh object behaves. So far it runs smoothly on mac, windows and Ubuntu.
I stripped down everything to a MWE, reported below:
class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseEntered(int x, int y); void mouseExited(int x, int y); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); ofVboMesh mesh; ofImage monoscope; }; void ofApp::setup() { monoscope.load("monoscope.jpg"); int w = ofGetWidth(); int h = ofGetHeight(); mesh.clear(); mesh.setMode(OF_PRIMITIVE_TRIANGLES); mesh.addVertex(ofPoint(10, 10, 0)); mesh.addVertex(ofPoint(w-10, 10, 0)); mesh.addVertex(ofPoint(w-10, h-10, 0)); mesh.addVertex(ofPoint(10, h-10, 0)); w = monoscope.getWidth(); h = monoscope.getHeight(); mesh.addTexCoord(ofVec2f(0, 0)); mesh.addTexCoord(ofVec2f(w-1, 0)); mesh.addTexCoord(ofVec2f(w-1, h-1)); mesh.addTexCoord(ofVec2f(0, h-1)); mesh.addIndex(0); mesh.addIndex(1); mesh.addIndex(3); mesh.addIndex(1); mesh.addIndex(2); mesh.addIndex(3); } void ofApp::draw() { ofBackground(0, 0 , 0); ofSetColor(255); ofTexture& tex = monoscope.getTexture(); tex.bind(); mesh.draw(); tex.unbind(); ofSetColor(255, 0, 0); mesh.drawWireframe(); }
monoscope is a simple jpeg picture in data folder. Well, on mac the output is (as expected) this:
Lines are a little thin but the mesh is drawn correctly, and so the binded texture. On the RasPi (sorry I had to take a picture because of apps do not appear in screenshots) the mesh is missing the vertical lines and the binded texture is not there.
I really could use some help here, thank you!
Davide
Posts: 4
Participants: 2