[vtkusers] Read OBJ files from QResource file

Rakesh Patil rakesh.p at tataelxsi.co.in
Fri Feb 26 05:49:32 EST 2016


Dear users,

I am trying to display a 3D object from OBJ file. I make use of vtkOBJReader to read the file. This works fine if I give the file name with absolute path. I am using QT as a GUI, and all my images/icons are stored in a resource (QResource(*.qrc)) file. I am able to read the images and icon from the resource file. But I am not able to read the OBJ file. Here is the code snippet to read image file from qrc file
QImage *image = new QImage(":/images/testImage.png");

On the similar lines, I want to get OBJ file, here is what I do:
QFile file(":/images/testObj.obj");

vtkOBJReader *reader = vtkOBJReader::New();
reader->SetFileName(file.fileName().toStdString().c_str());
reader->Update();

While reader is calling Update function, it throws error message saying ":/images/testObj.obj" file not found. I would like to know, how to read an OBJ file from a resource file using vtkOBJReader.

Thanks in advance



Warm Regards

Rakesh Patil


Consultant

Tata Elxsi

Hoody, ITPB Road,

Whitefield, Bangalore 560048
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160226/72154755/attachment.html>


More information about the vtkusers mailing list