[vtk-developers] QVTKWidget with virtualgl

shiva sitamraju shivaenigma at gmail.com
Wed Apr 8 14:44:24 EDT 2009


Oops ! Thanks a lot. I missed the if condition.
We are unsure if it is a vglrun bug because vglrun has run perfectly for us
on different types of OpenGl  applications. Maybe there is some special
opengl feature used by VTK which is not handled by vglrun, then we have to
investigate on what that its.

I will send u the code to reproduce this bug. Its a simple QtGridLayout with
four QVTKWidgets.

We will further try to zero in on the problem and keep u updated.

Thanks
-Shiva

On Wed, Apr 8, 2009 at 11:24 PM, Clinton Stimpson <clinton at elemtech.com>wrote:

>
> That code only gets called if you want to draw the vtk scene into something
> other than the QVTKWidget.
> So its direct rendering, except when you want to copy it into another
> QPaintDevice such as a QImage or QPixmap.  QPixmap::grabWidget() is a way to
> invoke that code.
> Under normal use, it really is doing direct rendering.
>
> I've also seen artifacts and trashed windows like yours when using compiz
> on Linux, and interestingly, I don't see it until a 4th child window is
> created, and your example has 4 child windows.
>
> Clint
>
> shiva sitamraju wrote:
>
>> I am pasting code from QVTKWidget.cxx  void
>> QVTKWidget::resizeEvent(QResizeEvent* e)  function from vtk-5.4.
>> As you can see it is calling this->mRenWin->GetRGBACharPixelData(0, 0,
>> w-1, h-1, 1, pixels);
>>
>>  // In Qt 4.1+ let's support redirected painting
>> #if QT_VERSION >= 0x040100
>>  // if redirected, let's grab the image from VTK, and paint it to the
>> device
>>  QPaintDevice* device = QPainter::redirected(this);
>>  if(device != NULL && device != this)
>>    {
>>    int w = this->width();
>>    int h = this->height();
>>    QImage img(w, h, QImage::Format_RGB32);
>>    vtkUnsignedCharArray* pixels = vtkUnsignedCharArray::New();
>>    pixels->SetArray(img.bits(), w*h*4, 1);
>>    this->mRenWin->GetRGBACharPixelData(0, 0, w-1, h-1, 1, pixels);
>>    pixels->Delete();
>>    img = img.rgbSwapped();
>>    img = img.mirrored();
>>        QPainter painter(this);
>>    painter.drawImage(QPointF(0.0,0.0), img);
>>    return;
>>
>> On Wed, Apr 8, 2009 at 3:32 AM, Clinton Stimpson <clinton at elemtech.com<mailto:
>> clinton at elemtech.com>> wrote:
>>
>>
>>    Could be a bug in vglrun ??
>>    I don't know what readback you're referring to.  Its supposed to
>>    render directly.
>>
>>    Clint
>>
>>    shiva sitamraju wrote:
>>
>>        Hi ,
>>
>>        We are using QVTKWidget in our application and running our
>>        application remotely using vglrun.  Without using vglrun
>>        everything is fine. I dont know if this is a problem with vtk
>>        or virtualgl, but here are the issues:
>>
>>        1. With vglrun the QVTKWidget display isn't getting refreshed
>>        properly (see the attached image)
>>        2. Also I see that QVTKWidget is doing a readback and then
>>        painting the qtwidget everytime refresh is performed.
>>        I guess this readback maybe causing problems with virtualgl.
>>        Is there a way to make VTK directly render to a qt opengl
>>        context instead of doing a readback.
>>
>>        Thanks,
>>        Shiva
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>        _______________________________________________
>>        Powered by www.kitware.com <http://www.kitware.com>
>>
>>        Visit other Kitware open-source projects at
>>        http://www.kitware.com/opensource/opensource.html
>>
>>        Follow this link to subscribe/unsubscribe:
>>        http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090409/7ed9eae6/attachment.html>


More information about the vtk-developers mailing list