ofMesh issue in RPi 2

Hi All,

I’m having a bit of an issue getting a set of triangles in ofMesh to render correctly in the Raspberry Pi 2.

code:

void ofApp::setup(){

mesh.addVertex(ofVec3f(10, 10, 1));
mesh.addVertex(ofVec3f(200, 10, 1));
mesh.addVertex(ofVec3f(400, 10, 1));
mesh.addVertex(ofVec3f(800, 10, 1));

mesh.addVertex(ofVec3f(10, 600, 1));
mesh.addVertex(ofVec3f(200, 600, 1));
mesh.addVertex(ofVec3f(400, 600, 1));
mesh.addVertex(ofVec3f(800, 600, 1));

mesh.addIndex(0);
mesh.addIndex(1);
mesh.addIndex(4);
mesh.addIndex(1);
mesh.addIndex(5);
mesh.addIndex(4);
mesh.addIndex(1);
mesh.addIndex(2);
mesh.addIndex(5);
mesh.addIndex(2);
mesh.addIndex(6);
mesh.addIndex(5);
mesh.addIndex(2);
mesh.addIndex(3);
mesh.addIndex(6);
mesh.addIndex(3);
mesh.addIndex(7);
mesh.addIndex(6);

}
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){

ofBackground(0);

ofSetColor(200);

mesh.drawWireframe();
}

The result on OS X is this:

But on the Pi is this:

Notice that none of the triangles are closed.

Am I misunderstanding something basic about the way ofMesh and the indices work, or is there something funky with the way the Pi 2 renders meshes?

Thanks in advance!

c.

Shot in the dark here - but could it be something to do with setting a different winding order on the code for the pi?

Thanks for the reply. I tried every permutation that I can think of, but no joy. I can report that rendering via drawFaces() produces the expected result… it is just drawWireframe() that doesn’t seem to work for me. By the way, I tried OF_PRIMITIVE_TRIANGLE_STRIP and (after adjusting the indices) got the same result.

Not that it should be different but you may want to try the Programmable Renderer to see if it is what you expect.

in main.cpp

ofGLESWindowSettings settings;
    settings.width = 1280;
    settings.height = 720;
    settings.setGLESVersion(2);
    ofCreateWindow(settings);

opengl es can’t draw wireframes easily, to do that you need to explicitly set the indices of your mesh t(or the order of the vertices) to draw the wireframe.

at some point we should add something that generates the correct triangles as an auxiliary mesh to draw the wireframe automatically in GLES but by now you need to do it manually.

the vertices as they are laid out with TRIANGLE_STRIP will draw like that when drawn with LINES (thaht’s all that’s happening when you draw the wireframe in GLES)

to draw it correctly you have to lay them out as if you were drawing triangles

Good to know, thanks Arturo.