# vtkOpenGLExtensionManager not Available in VTK 9.3 | Qt 6.5.6 |Unable to initialize OpenGL functions after porting to vtk 9 from vtk 4

**URL:** <https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953>\
**Category:** Development\
**Tags:** code\
**Created:** [December 4, 2024, 7:13am UTC](https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953 "2024-12-04T07:13:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ataban](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@ataban](https://discourse.vtk.org/u/ataban)\
**Post date:** [December 4, 2024, 7:13am UTC](https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953/1 "2024-12-04T07:13:28Z")

</div>

Hi ,

Currently we are using Qt 6.5.6 in our application and thats the main criteria. To use medical images and operations related to those images (pan/zoom/windowing) earlier in qt 5.5 version we were using vtk 4.10 and all the image related operations were very smooth and performance was fine.  
After migrating to Qt 6.5, we migrated vtk to v9.3 and started facing performance related issues during image operations.  
Upon debugging it is found out that vtkOpenGLExtensionManager class is missing in vtk 9.3 which was present in vtk 4 which was initializing openGL functions for caching vtk image across operations.

Now i have 2 questions here

1. Whats the alternate in vtk 9.3 to vtkOpenGLExtensionManager class i.e to use openGL function initializations.
2. Is updating to vtk 9.3 mandatory to work with qt6.5 where as vtk 4.10 was working perfectly with qt 5.5?

Secondly, To overcome this vtkOpenGLExtensionManager we are using QVTKOpenGLNativeWidget in conjuction with vtkGenericOpenGLRenderWindow in qt 6.5 instead of QVTKGraphicsWidget used earlier in qt 5.5 and we started facing performance issues like image operations are being slowed down.  
Any setting/configuration that we can use in QVTKOpenGLNativeWidget that can compensate the performance like in QVTKGraphicsWidget/vtkQtOpenGLRenderWindow2 ?

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [December 4, 2024, 1:50pm UTC](https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953/2 "2024-12-04T13:50:41Z")

</div>

There was no vtkOpenGLExtensionManager in VTK 4, perhaps you were using VTK 5.10?

1. VTK 9.3 used a third-party package called “glew” to manage OpenGL extensions. VTK 9.4 uses a third-party package called “glad” for the same purpose. But management of OpenGL extensions is usually done internally by VTK itself, what were you using the vtkOpenGLExtensionManager for?
2. VTK 5.10 over ten years old and long past its end-of-life, it was released around 8 years before Qt 6 even existed. I don’t know of anyone actively trying to modify VTK 5.10 for use with qt 6.

You can try calling `ReportCapabilities()` on your render window after the first call to `Render()`. This method returns a string with information about the OpenGL context.

My suspicion is that the slowdowns aren’t related to OpenGL, but are instead caused by changes in the VTK pipeline between VTK 5.10 and VTK 9.3 that you haven’t accounted for when modifying your code to work with VTK 9.3. But without seeing your code, it’s impossible to know for sure.

---

<div class="post-metadata">

**Author:** ![ataban](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@ataban](https://discourse.vtk.org/u/ataban)\
**Post date:** [December 6, 2024, 9:43am UTC](https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953/3 "2024-12-06T09:43:36Z")

</div>

hi , Thanks for your time and response.

I have taken care of 2nd point mentioned above , thats the slowness of the image rendering by adding update() on the widget on move event .

But the 1st point needs your input further where we need to replace vtkOpenGLExtensionManager as our code inside widget → setCacheVtkBackground() using that extention to set other functions which is causing issue as vtkOpenGLExtensionManager no more available. Attaching source snippet for your reference.

void ourGraphicsWidget::setCacheVtkBackground( bool value )  
{  
if (d-\>mCacheVtkBackground != value) {  
d-\>mCacheVtkBackground = value;

```
    if (d->mCacheVtkBackground) {

        vtkOpenGLRenderWindow* oglRenWin = this->GetRenderWindow();
      / vtkOpenGLExtensionManager* extMan = NULL;
        if (oglRenWin) {
            extMan = oglRenWin->GetExtensionManager();
        }

        if (extMan) {
            // Verify the OpenGl environment supports it.
            extMan->SetRenderWindow(this->GetRenderWindow());
            bool hasObj = QOpenGLFramebufferObject::hasOpenGLFramebufferObjects();
            // Can only do caching if the OpenGL environment supports frame buffer objects.
            d->mCacheVtkBackground = d->mCacheVtkBackground && hasObj;

            // Need non-power-two textures too.
            d->mCacheVtkBackground = d->mCacheVtkBackground &&
                (extMan->ExtensionSupported("GL_VERSION_2_0") || // GL2.0 has non-power-two textures by default
                    extMan->ExtensionSupported("GL_ARB_texture_non_power_of_two"));

            if (!s_backgroundCachingMessageDisplayed) {
                if (value) {
                    if (d->mCacheVtkBackground) {
                        qDebug() << "Widget:Background caching enabled";
                    }
                    else {
                        qDebug() << "Widget:Background caching not supported:";
                        if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()) {
                            qDebug() << " - OpenGLFramebufferObjects are not supported";
                        }
                        else {
                            if (!extMan->ExtensionSupported("GL_VERSION_2_0"))
                                qDebug() << " - GL_VERSION_2_0 extension not supported";
                            if (!extMan->ExtensionSupported("GL_ARB_texture_non_power_of_two"))
                                qDebug() << " - GL_ARB_texture_non_power_of_two extension not supported";
                        }*/
                    }
                }
                s_backgroundCachingMessageDisplayed = true;
            }

        /*}
        else {
            if (!s_backgroundCachingMessageDisplayed) {
                if (value) {
                    qDebug() << "GraphicsWidget:Background caching not supported : extension manager not available.";
                }
                else {
                    qDebug() << "GraphicsWidget:Background caching not enabled.";
                }
                s_backgroundCachingMessageDisplayed = true;
            }
            d->mCacheVtkBackground = false;
        }*/
    }

    if (!d->mCacheVtkBackground) {

        if (d->mFBO) {
            delete d->mFBO;
            d->mFBO = NULL;
        }
    }
    }

```

}

how to add GLEW in cmake like other modules?

if((VTK\_MAJOR\_VERSION EQUAL 9) AND (VTK\_MINOR\_VERSION GREATER 0))  
find\_package(VTK COMPONENTS  
CommonCore  
RenderingVolume  
InteractionImage  
)

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [December 6, 2024, 6:42pm UTC](https://discourse.vtk.org/t/vtkopenglextensionmanager-not-available-in-vtk-9-3-qt-6-5-6-unable-to-initialize-opengl-functions-after-porting-to-vtk-9-from-vtk-4/14953/4 "2024-12-06T18:42:20Z")

</div>

Since VTK 9 already requires `GL_VERSION_2_0`, do you even need these checks?

I haven’t used glew myself, so unfortunately I have no instructions on its use.
