[vtk-developers] QVTKWidget with virtualgl

shiva sitamraju shivaenigma at gmail.com
Wed Apr 8 13:46:57 EDT 2009


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>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
>>
>> 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/20090408/f21d38f4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qvtk.png
Type: image/png
Size: 6158 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090408/f21d38f4/attachment-0001.png>


More information about the vtk-developers mailing list