Strange ofVboMesh behavior on Raspberry Pi

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

I also tried using ofMesh instead of ofVboMesh, but that didn’t change anything.

Is the texture able to draw by itself?

e.g.

tex.draw(0, 0)

I just checked and yes, the texture is perfectly able to draw itself.

texture coordinates in the pi as well as android ios and any GLES platform are normalized so you should transform them from 0…w, 0…h to 0…1

you can default desktop apps to use normalized textures as well with:

ofDisableArbTex()

at the beginning of setup that way the application will behave the same in both platforms

Thank you, now it is working!

There are just a couple of minor issues, I had to put a few conditionals because the video player outputs a blank screen on OSX. I understand this is a known issue but it doesn’t seem to work even with the last nightly build.

Then for some reason the vertical lines in the mesh wireframe still do not get drawn. Ok I can live with that, but may be it is a sign that something is not working as it should be.

ciao
Davide