Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 759
    • Issues 759
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 202
    • Merge requests 202
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #17154
Closed
Open
Created Oct 23, 2017 by Boris Basic@borisbReporter

Incorrect lines rendering with QVTKOpenGLNativeWidget

When moving from the deprecated QVTKWidget to the QVTKOpenGLNativeWidget, I noticed lines looked less smooth than before. To illustrate the problem, I created a window showing 3 axes using the old widget, the new one, and one using a standard Win32 window. The expected behavior is displayed by QVTKWidget and the Win32 window, while in QVTKOpenGLNativeWidget, lines looked like they are a little blended with the background.

It is to be noted that using the new QVTKOpenGLWidget resolves the issue, but it is present with QVTKOpenGLNativeWidget.

Screens:

2017-10-23_16h51_17 2017-10-23_16h39_14 2017-10-23_16h39_49

Environment: Windows 7 64-bit, Quadro 2000, Xeon E5-1603 0, MSVC 2015 Update 3.

Here is the code I used:

#include <QApplication>

#include <vtkActor.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkAxes.h>
#include <vtkProperty.h>
#include <vtkCamera.h>

#include <QVTKWidget.h>
#include <QVTKOpenGLNativeWidget.h>
#include <QSurfaceFormat>

//#define NO_QT
#define OLD_WIDGET

int main(int argc, char** argv)
{
  // Create X,Y,Z axes at the origin
  vtkNew<vtkAxes> centerAxes;
  centerAxes->SetOrigin(0, 0, 0);
  centerAxes->SetSymmetric(1);
  centerAxes->SetComputeNormals(1);
  vtkNew<vtkPolyDataMapper> axesMapper;
  axesMapper->SetInputConnection(centerAxes->GetOutputPort());
  vtkSmartPointer<vtkActor> centerAxesActor = vtkSmartPointer<vtkActor>::New();
  centerAxesActor->SetMapper(axesMapper);
  centerAxesActor->GetProperty()->SetLighting(false);
  centerAxesActor->PickableOff();
  centerAxesActor->SetScale(0.4);

  vtkNew<vtkRenderer> renderer;
  renderer->AddActor(centerAxesActor);
  renderer->SetBackground(0.06, 0.2, 0.5);

  double pos[3] = { 1, 0.2, 1 };
  double focalPoint[3] = { 0, 0, 0 };
  double viewUp[3] = { 0, 1, 0 };
  renderer->GetActiveCamera()->SetPosition(pos);
  renderer->GetActiveCamera()->SetFocalPoint(focalPoint);
  renderer->GetActiveCamera()->SetViewUp(viewUp);

#ifdef NO_QT
  vtkNew<vtkRenderWindow> renderWindow;
  renderWindow->AddRenderer(renderer);
  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
  renderWindowInteractor->SetRenderWindow(renderWindow);
  renderWindow->SetSize(512, 512);
  renderWindow->Render();
  renderWindowInteractor->Start();
#else
  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
  QApplication app(argc, argv);
#  if defined OLD_WIDGET
    QVTKWidget widget;
#  else
    QVTKOpenGLNativeWidget widget;
    vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
    widget.SetRenderWindow(renderWindow);
#  endif // OLD_WIDGET
	widget.resize(512, 512);
	widget.GetRenderWindow()->AddRenderer(renderer);
	widget.show();
	app.exec();
#endif // NO_QT

  return EXIT_SUCCESS;
}

@utkarsh.ayachit @cory-quammen @msmolens

Edited Sep 03, 2018 by Boris Basic
Assignee
Assign to
Time tracking