[Ctk-developers] Running error of 'vtkContextDevice2D'

Julien Finet julien.finet at kitware.com
Fri Apr 17 09:54:31 EDT 2015


Hi Quentan,

Can you try to add *vtkRenderingContextOpenGL *in *VTK_LIBRARIES *within
the if block *IF (${CTK_USE_CHARTS}) *?
https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/CMakeLists.txt#L160

Thanks,
Julien.

On Thu, Apr 2, 2015 at 2:10 PM, Quentan Qi <quentan at gmail.com> wrote:

> Dear Community Members,
>
> I’m now using CTK for VTK UI design, and want to use its
> `ctkVTKVolumePropertyWidget` widget, but received `no override found for
> 'vtkContextDevice2D’.` error.
>
> The test application `ctkVTKVolumePropertyWidgetTest1` of
> `/CTKBuild/CTK-build/bin/CTKVisualizationVTKWidgetsCppTests`receives the
> same error.
>
> A mail list <http://marc.info/?l=vtk-developers&m=140685424721837&w=2> explains
> this error of the OpenGL override moving from `vtkContextDevice2D` to
> `Rendering/ContextOpenGL`, but I have no idea how to split it. Is there any
> detailed solution?
>
>
> ### CTK build options, using the latest CTK fork 02-Apr-2015
> ```
> cmake -DCMAKE_MACOSX_RPATH:BOOL=OFF
> -DCMAKE_INSTALL_PREFIX:STRING=/usr/local/ctk
> -DCMAKE_BUILD_TYPE:STRING=Release -DCTK_ENABLE_Widgets:BOOL=ON
> -DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON
> -DVTK_DIR:PATH=/usr/local/vtk/lib/cmake/vtk-6.2
> -DCTK_BUILD_EXAMPLES:BOOL=ON -DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON
> -DITK_DIR:PATH=/usr/local/itk/lib/cmake/ITK-4.7
> -DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON
> ../CTKSource
> ```
>
> > Note: I used
> `-DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON`
> flag for volume transfer function widget. It is right?
>
> ### `CMakeLists.txt`
> ```
> cmake_minimum_required(VERSION 3.1)
>
> project(TEST_VTK_CTK)
>
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
>
> find_package(CTK REQUIRED)
> include(${CTK_USE_FILE})
>
> #find_package(ITK REQUIRED)
> #include(${ITK_USE_FILE})
>
> find_package(VTK REQUIRED)
> include(${VTK_USE_FILE})
>
> find_package(Qt4 REQUIRED)
> include(${QT_USE_FILE})
>
> set(SOURCE_FILES_6 PlayGround.cxx)
> add_executable(Test6 MACOSX_BUNDLE ${SOURCE_FILES_6})
> target_link_libraries(Test6 ${CTK_LIBRARIES} ${VTK_LIBRARIES})
> ```
>
> ### Source file
> ```
> // Qt includes
> #include <QApplication>
>
> // CTK-VTK includes
> #include "ctkVTKVolumePropertyWidget.h"
>
> // VTK includes
> #include <vtkColorTransferFunction.h>
> #include <vtkPiecewiseFunction.h>
> #include <vtkSmartPointer.h>
> #include <vtkVolumeProperty.h>
>
> // STD includes
> #include <iostream>
>
>
> //-----------------------------------------------------------------------------
> int main(int argc, char * argv [] ) {
>
>     QApplication app(argc, argv);
>
>     vtkSmartPointer<vtkColorTransferFunction> ctf =
>             vtkSmartPointer<vtkColorTransferFunction>::New();
>     ctf->AddRGBPoint(0.2, 0.6941,0.76,0., 0.5, 0.);
>     ctf->AddRGBPoint(0.4, 0.,0.6941,0.96);
>     ctf->AddRGBPoint(0.8, 0.9686,0.76,0.);
>
>     vtkSmartPointer<vtkPiecewiseFunction> otf =
>             vtkSmartPointer<vtkPiecewiseFunction>::New();
>     otf->AddPoint(0.2, 0.6941);
>     otf->AddPoint(0.4, 0.641);
>     otf->AddPoint(0.8, 0.9686);
>
>     vtkSmartPointer<vtkPiecewiseFunction> otf2 =
>             vtkSmartPointer<vtkPiecewiseFunction>::New();
>     otf2->AddPoint(0.0, 0.6941);
>     otf2->AddPoint(0.1, 0.641);
>     otf2->AddPoint(0.7, 0.9686);
>
>     vtkSmartPointer<vtkVolumeProperty> volumeProperty =
>             vtkSmartPointer<vtkVolumeProperty>::New();
>     volumeProperty->SetColor(ctf);
>     volumeProperty->SetScalarOpacity(otf);
>     double range[2] = {0., 1.};
>     volumeProperty->GetGradientOpacity()->AdjustRange(range);
>
>     ctkVTKVolumePropertyWidget widget;
> //    widget.setUseThresholdSlider(true);
>     widget.setVolumeProperty(volumeProperty);
>
>     volumeProperty->SetScalarOpacity(otf2);
>
>     widget.moveAllPoints(0.1, -0.1);
>     widget.moveAllPoints(-0.1, 0.1);
>
>     widget.show();
>
>     return app.exec();
> }
> ```
>
> This is an example from `
> https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKVolumePropertyWidgetTest1.cpp`
> .
>
> ### Running error info (No compiling error)
> ```
> Generic Warning: In
> /Develop/VTK/VTKSource-6.2.0/Rendering/Context2D/vtkContextDevice2D.cxx,
> line 27
> Error: no override found for 'vtkContextDevice2D'.
>
>
> Process finished with exit code 11
> ```
>
> Cheers,
> Quentan
>
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/ctk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20150417/febaf056/attachment.html>


More information about the Ctk-developers mailing list