Hi, I&#39;m attempting to embed a VTK render window into my At app, I&#39;m<br>
using the code below to display a cone in the window, but all I get is<br>
the background. I included the popup from the QVTK events example and<br>
I&#39;m trying to display a cone. All I get is the background, the popup<br>
menu works, but no cone. Any clues regarding what I am doing wrong? I<br>
tried this same example without QVTK and it worked perfectly. I am using the CVS version of VTK and qt-sdk-2009.02.<br><br>Regards,<br>     -Joshua<br>
<br>
void MainWindow::SetupScene()<br>
{<br>
        QVTKWidget* qvtkwidget = ui.qvtkWidget;<br>
<br>
        {<br>
                vtkRenderWindow* renWin = vtkRenderWindow::New();<br>
                //renWin-&gt;<div id=":rv" class="ii gt">StereoCapableWindowOn();<br>
                qvtkwidget-&gt;SetRenderWindow(renWin);<br>
                renWin-&gt;Delete();<br>
        }<br>
<br>
        //add a popup menu for the window and connect it to our slot<br>
        QMenu* popup1 = new QMenu(qvtkwidget);<br>
        popup1-&gt;addAction(&quot;Background White&quot;);<br>
        popup1-&gt;addAction(&quot;Background Black&quot;);<br>
        //popup1-&gt;addAction(&quot;Stereo Rendering&quot;);<br>
        connect(popup1, SIGNAL(triggered(QAction*)), this,<br>
SLOT(color(QAction*)));<br>
<br>
        vtkEventQtSlotConnect* Connections = vtkEventQtSlotConnect::New();<br>
<br>
        Connections-&gt;Connect(qvtkwidget-&gt;GetRenderWindow()-&gt;GetInteractor(),<br>
                        vtkCommand::RightButtonPressEvent,<br>
                        this,<br>
                        SLOT(popup( vtkObject*, unsigned long, void*,<br>
void*, vtkCommand*)),<br>
                        popup1, 1.0);<br>
<br>
        //Put cone in window<br>
        {<br>
                vtkConeSource *cone = vtkConeSource::New();<br>
<br>
                vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();<br>
<br>
                // 3<br>
                coneMapper-&gt;SetInputConnection(cone-&gt;GetOutputPort());<br>
                vtkActor *coneActor = vtkActor::New();<br>
                coneActor-&gt;SetMapper(coneMapper);<br>
                coneMapper-&gt;Delete();<br>
                vtkRenderer *ren = vtkRenderer::New();<br>
<br>
<br>
                ren-&gt;AddActor(coneActor);<br>
                coneActor-&gt;Delete();<br>
                ren-&gt;SetBackground(0.3, 0.3, 0.4);<br>
                ren-&gt;SetBackground2(0.9, 0.9, 1);<br>
                ren-&gt;AutomaticLightCreationOn();<br>
                ren-&gt;GradientBackgroundOn();<br>
                //ren-&gt;WorldToDisplay();<br>
<br>
                qvtkwidget-&gt;GetRenderWindow()-&gt;AddRenderer(ren);<br>
                qvtkwidget-&gt;GetRenderWindow()-&gt;BordersOn();<br>
<br>
                ren-&gt;Delete();<br>
        }<br>
}<br>
<br>
void MainWindow::popup(vtkObject * obj, unsigned long, void * client_data,<br>
                       void *, vtkCommand * command)<br>
{<br>
        // A note about context menus in Qt and the QVTKWidget<br>
        // You may find it easy to just do context menus on right button up,<br>
        // due to the event proxy mechanism in place.<br>
<br>
        // That usually works, except in some cases.<br>
        // One case is where you capture context menu events that<br>
        // child windows don&#39;t process.  You could end up with a second<br>
        // context menu after the first one.<br>
<br>
        // See QVTKWidget::ContextMenuEvent enum which was added after the<br>
        // writing of this example.<br>
<br>
        // get interactor<br>
        vtkRenderWindowInteractor* iren =<br>
vtkRenderWindowInteractor::SafeDownCast(<br>
                obj);<br>
        // consume event so the interactor style doesn&#39;t get it<br>
        command-&gt;AbortFlagOn();<br>
        // get popup menu<br>
        QMenu* popupMenu = static_cast&lt;QMenu*&gt; (client_data);<br>
        // get event location<br>
        int* sz = iren-&gt;GetSize();<br>
        int* position = iren-&gt;GetEventPosition();<br>
        // remember to flip y<br>
        QPoint pt = QPoint(position[0], sz[1] - position[1]);<br>
        // map to global<br>
        QPoint global_pt = popupMenu-&gt;parentWidget()-&gt;mapToGlobal(pt);<br>
        // show popup menu at global point<br>
        popupMenu-&gt;popup(global_pt);<br>
}<br>
<br>
void MainWindow::color(QAction* color)<br>
{<br>
        QVTKWidget* qvtkwidget = ui.qvtkWidget;<br>
        vtkRenderer* ren =<br>
<br>
qvtkwidget-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer();<br>
        if (color-&gt;text() == &quot;Background White&quot;)<br>
                ren-&gt;SetBackground(1, 1, 1);<br>
        else if (color-&gt;text() == &quot;Background Black&quot;)<br>
                ren-&gt;SetBackground(0, 0, 0);<br>
        else if (color-&gt;text() == &quot;Stereo Rendering&quot;)<br>
        {<br>
                ren-&gt;GetRenderWindow()-&gt;SetStereoRender(<br>
                        !ren-&gt;GetRenderWindow()-&gt;GetStereoRender());<br>
        }<br>
        qvtkwidget-&gt;update();<br>
}</div>