ofMesh drawWireframe() not rendering correctly

im loading a simple disc model that i made in Cinema4d.
ive exported it out in a few different formats with the same results.

when loading in OF, the wireframe is draw incorrectly…
im trying to work out if this is a know bug with ofMesh or if i need to export the wireframe model differently.
anyone encounter this before? couldn’t find anything on the forum and github…

please see the before and after.

What format are you exporting?

I’ve tried exporting simple triangulated disc from Cinema 4d in 3DS format, loaded it inside Openframeworks with ofx3DModelLoader and also got different wireframe from what’s inside Cinema 4d, but I guess there is a difference of how Cinema 4d handles it’s vertex positions/order and rendering, from what GL_LINES draw mode will expect to get this kind of wireframe. Do you get normal rendering, when you switch to GL_TRIANGLES draw mode?

hey kamend,
thx for your response.

i just got one step closer to a solution…
the loadModel() method has the optimize parameter set to always true,
so if you don’t explicitly set it to false, it will optimise the model and do all sort of crazy stuff.
as i have just found, this can be very confusing and i will suggest on github to turn the default for model optimisation to false.
here is what im getting now, much better… but still missing lines.

there is still definitely an issue with the way ofMesh renders a wireframe.
you might be right… the vertex positions/order might not be suitable for GL_LINES.
but then, should ofMesh be offering the option to draw a wireframe if it can’t do it properly.
guess the question still remains,
is this a bug?
or a incomplete feature?

btw, exporting 3ds from cinema4d gives me the same result as in the image above when using ofxAssimpModelLoader.
maybe ofx3DModelLoader also does some internal optimisation on the model…

Here is how to get the correct wireframe, you just need to create your own ofMesh inside model3DS.cpp, here is a hackish code to do that, but I will try to modify the 3ds loading code to use ofMesh when I find a little bit of free time. See the attached model3DS.cpp and void mesh3DS::draw(), I have added a new drawing mode: DRAW_MY_MESH_MODE.

model3DS.cpp

But of course this is really not the correct way to do it, especially with larger models and a lot of vertices, because you are adding way more vertices and not using indices :slight_smile:

@kamend, cool thx for the code! but im trying to work with ofxAssimpModelLoader on this project.

ive managed to get it working by swapping GL_LINES for GL_LINE_STRIP in ofxAssimpModelLoader
https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp#L846

will update this on github.