<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>Dear users,</div>
<div><br>
</div>
<div>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</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><i><strong>QImage *image = new QImage(":/images/testImage.png");</strong></i></div>
<div><br>
</div>
<div>On the similar lines, I want to get OBJ file, here is what I do:</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><em><strong>QFile file(":/images/testObj.obj");</strong></em></div>
<div><br>
</div>
<div><em><strong>vtkOBJReader *reader = vtkOBJReader::New();</strong></em></div>
<div><em><strong>reader->SetFileName(file.fileName().toStdString().c_str());</strong></em></div>
<div><em><strong>reader->Update();</strong></em></div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks in advance</div>
<br>
<p></p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Warm Regards<br>
</p>
<p>Rakesh Patil</p>
<p><br>
</p>
<p>Consultant</p>
<p>Tata Elxsi</p>
<p>Hoody, ITPB Road,</p>
<p>Whitefield, Bangalore 560048<br>
</p>
</div>
</div>
</div>
</body>
</html>