<html>
John,<br>
Thanks for the bug report. Your fix is certainly correct. However, I
believe <br>
that the bug only occurs when a texture id is present. In the
OBJReader.tcl <br>
example, cow.obj does not have texture id's, thus the lines 208... are
never <br>
reached.<br>
I don't believe we have an obj files with texture. I'll try to generate
one <br>
so we can test your fix,<br>
<br>
Bill<br>
<br>
At 09:36 AM 10/31/00 -0500, John Tourtellott wrote:<br>
<tt><blockquote type=cite cite>I believe that the vtkOBJReader class
never reads vertex normals from an input file, due to a bug in
vtkOBJReader.cxx at lines 208-209:</tt> <br>
<br>
<tt>&nbsp;&nbsp;&nbsp; 208&nbsp;&nbsp; blank = (char *) strchr (line,
(int) ' ');</tt> <br>
<tt>&nbsp;&nbsp;&nbsp; 209&nbsp;&nbsp; slash = (char *) strchr (line,
(int) '/');</tt> <br>
<tt>&nbsp;&nbsp;&nbsp; 210&nbsp;&nbsp; if (blank &amp;&amp; slash
&amp;&amp; (slash &lt; blank))</tt> <br>
<tt>&nbsp;&nbsp;&nbsp; 211&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</tt> <br>
<br>
<tt>This code is in the middle of parsing a vertex/texture/normal string
for the next&nbsp; index into the array of normals. Because the current
code parses from the beginning of the 'line' variable, the resulting
'blank' value is always less than the 'slash' value and, as a result, the
subsequent if statement (line 210) always evaluates to false. Instead,
the parsing should be done with respect to the current pointer position,
i.e., the correct code is:</tt> <br>
<br>
<tt>&nbsp;&nbsp;&nbsp; 208&nbsp;&nbsp; blank = (char *) strchr (ptr,
(int) ' ');</tt> <br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
^^^</tt> <br>
<tt>&nbsp;&nbsp;&nbsp; 209&nbsp;&nbsp; slash = (char *) strchr (ptr,
(int) '/');</tt> <br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
^^^</tt> <br>
<br>
<tt>I found this out when using the vtkOBJReader class in a C program,
but I believe you can see it in the tclOBJReader.tcl example. I don't
know much about tcl, but at line 75 (before starting the interactor) I
added:</tt> <br>
<br>
<tt>&nbsp;&nbsp; set n [[[wavefront GetOutput] GetPoints]
GetNumberOfPoints]</tt> <br>
<tt>&nbsp;&nbsp; vtkNormals normals</tt> <br>
<tt>&nbsp;&nbsp; set normals [[[wavefront GetOutput] GetPointData]
GetNormals]</tt> <br>
<tt>&nbsp;&nbsp; set m [normals GetNumberOfNormals]</tt> <br>
<tt>&nbsp;&nbsp; message .msg -text &quot;There are $n points and $m
normals&quot;</tt> <br>
<tt>&nbsp;&nbsp; pack&nbsp;&nbsp;&nbsp; .msg</tt> <br>
<br>
<tt>and commented out line 81 (wm withdraw .) When I ran this on my PC,
the message window displays &quot;There are 12330 points and 0
normals&quot;, even though there are 4000 or so vertex normals in the
cow.obj file.</tt> <br>
&nbsp; <br>
&nbsp; </blockquote><br>
</html>