<div dir="ltr"><div>Hi Nil,</div><div><br></div>You shouldn't actually need to modify the code. You should just be able to turn off use of OpenGL display lists with vtkMapper::ImmediateModeRenderingOff().<div><br></div>
<div><a href="http://www.vtk.org/doc/nightly/html/classvtkMapper.html#ab9db044b3f5113808d2de42f13bb4fe8">http://www.vtk.org/doc/nightly/html/classvtkMapper.html#ab9db044b3f5113808d2de42f13bb4fe8</a><br></div><div><br></div>
<div>Let us know if that gives you the same near-real-time updates that removing calls to glNewList does.</div><div><br></div><div>Thanks,</div><div>Cory</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Jun 4, 2014 at 2:48 PM, Nil Goyette <span dir="ltr"><<a href="mailto:nil.goyette@imeka.ca" target="_blank">nil.goyette@imeka.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>HI all, I tried more things and I can
finally call it a success. Modifying the vtkPolyData when the cube
moves is a bad idea for real-time rendering. A simple
polydata->Modified() takes 3-4 seconds to render the next
frame. There's too much fibers and not enough time in a second.<br>
<br>
I had some good results using another vtkPolyData, building it
with the small subset of fibers passing by the cube and displaying
it with a normal mapper. It was rendering in real-time most of the
time, but not in the part with the most fibers.<br>
<br>
After a lot of trials and errors to make it fast, I discovered the
OpenGL list functions in vtkOpenGLPolyDataMapper.cxx: glGenLists,
glNewList, glEndList and glCallList. I understand why they were
used in the code (compiling a list of commands to make them fast
*after*), but I had to remove them to render in real-time. Now
moving around in the scene is slower, but rendering the filtered
fibers is as fast as I wanted it to be.<br>
<br>
In summary, the solution is to modify the vtkPolyDataMapper, not
the vtkPolydata, in order to draw only the fibers you need in
OpenGL.<br>
<br>
Le 2014-05-23 13:58, Nil Goyette a écrit :<br>
</div><div><div class="h5">
<blockquote type="cite">
<div>While waiting for an answer, I tried
coding the third solution I had: "Extend vtkPolyData to add the
concept of visibility". I took vtkStructuredGrid as an example,
noted where this->CellVisibility appears and extended
vtkPolyData with the important methods: Initialize, GetCellType
and GetCell_1-2, added Blank, UnBlank, etc.<br>
<br>
Of course, it didn't work and I'm not sure why. It seems
GetCell and GetCellType are never called. I was sure that one
method somewhere during the rendering process called them but
it's not the case. What I don't understand then is, if all
methods related to CellVisibility are not called, how can it
works for vtkStructuredGrid? There's no example using
vtkStructuredVisibilityConstraint. Do I need to pass the result
of polydata->GetCellVisibilityArray() to another method?<br>
<br>
Le 2014-05-21 10:43, Nil Goyette a écrit :<br>
</div>
<blockquote type="cite">
Hi,<br>
<br>
I'm searching how to recreate the FiberNavigator [1] using vtk
and I'm stuck on one problem. As you can see in my screenshot
[2], we use a little teal cube to filter which fibers we want to
see. The cube will be a vtkBoxWidget and the fibers are a
vtkPolyData. The problem is that there's no concept of cell
visibility in a vtkPolyData. I found this feature in
vtkStructuredGrid but I believe my data doesn't fit the class'
description. I found three ways to do what I want:<br>
<ol>
<li>Use vtkExtractSelectedPolyDataIds to extract only the
cells I need. I think this would be super slow.<br>
</li>
<li>Add/delete cells when the cube pass by. I think this would
also be slow.</li>
<li>Extend vtkPolyData to add the concept of visibility
(vtkStructuredVisibilityConstraint). This looks like the
best option to me but I may be wrong.</li>
</ol>
<p>I wonder what's the best way to filter the fibers. Do you
have any suggestions for me? Thanks for your time.<br>
</p>
[1] <a href="https://github.com/scilus/fibernavigator" target="_blank">https://github.com/scilus/fibernavigator</a><br>
[2] <a href="http://imgur.com/1edZpWT" target="_blank">http://imgur.com/1edZpWT</a><br>
</blockquote>
</blockquote>
<br>
</div></div><span class="HOEnZb"><font color="#888888"><div>-- <br>
<table cellpadding="2" cellspacing="2" width="218" border="0" height="96">
<tbody>
<tr>
<td valign="middle"> <a href="http://imeka.ca/" target="_blank"> <img alt="Logo Imeka" src="cid:part3.08010909.07000004@imeka.ca" width="66" height="67"> </a> </td>
<td valign="top"> Nil Goyette, M.Sc.<br>
Programmer<br>
<a href="http://imeka.ca/" target="_blank">www.imeka.ca</a> </td>
</tr>
</tbody>
</table>
</div>
</font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>