Skip to content

Loading .obj crashes executable (Windows / QtCreator / CMake 3.4 / MSVC 2017) #1033

@ygrimault

Description

@ygrimault

I created a simple program that asks the user to load a mesh, and everything works fine when loading bunny.off. However, when I try to load armadillo.obj (both from your tuto github https://github.com/libigl/libigl-tutorial-data), it crashes because of this failed assertion:

Assertion failed: a_startRow >= 0 && blockRows >= 0 && a_startRow <= xpr.rows() - blockRows && a_startCol >= 0 && blockCols >= 0 && a_startCol <= xpr.cols() - blockCols, file c:...\libigl\external\eigen\eigen\src/Core/Block.h, line 141

My main.cpp is simply:

#include <igl/readOFF.h>
#include <igl/opengl/glfw/Viewer.h>

#include <iostream>
using namespace std;

Eigen::MatrixXd V;
Eigen::MatrixXd TC;
Eigen::MatrixXd N;
Eigen::MatrixXi F;
Eigen::MatrixXi FTC;
Eigen::MatrixXi FN;

int main(int argc, char *argv[])
{
  // Load a mesh in OFF format
  //igl::readOBJ("../res/objects/armadillo.obj", V, TC, N, F, FTC, FN);
  //igl::readOFF("../res/objects/bunny.off", V, F);

  // Plot the mesh
  igl::opengl::glfw::Viewer viewer;
  //viewer.data().set_mesh(V, F);
  viewer.open_dialog_load_mesh();
  viewer.launch();
}

Note that it only crashes when using open_dialog_load_mesh(), the function readOBJ() works on this object. It doesn't on another object which has a material though, and it gives yet another error:

Assertion failed: (!(RowsAtCompileTime!=Dynamic) || (nbRows==RowsAtCompileTime)) && (!(ColsAtCompileTime!=Dynamic) || (nbCols==ColsAtCompileTime)) && (!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) || (nbRows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic) || (nbCols<=MaxColsAtCompileTime)) && nbRows>=0 && nbCols>=0 && "Invalid sizes when resizing a matrix or array.", file c:...\libigl\external\eigen\eigen\src/Core/PlainObjectBase.h, line 241

I'm using a 64-bit computer with Windows 10. I'm compiling using QtCreator 4.7.1 (Qt version 5.11.2), CMake 3.4 (had to use an earlier version to compile libigl otherwise I had errors when linking iirc), and MSVC 2017 (15.0, x86_amd64). I pulled the latest version of libigl as of 28th November 2018.

Note that I'm also getting a lot of warnings related to conversions that may lead to loss of data, I don't know if it can be linked together or not.

Check all that apply (change to [x])

  • Windows
  • Mac OS X
  • Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions