This OpenGL implementation does not support the required texture size

Sometimes I get a strange warning when is executing the following code (on vtkVolume):

m_pColorTransferFunction->AddRGBPoint(dLevel + dWindow, ...);
m_pColorTransferFunction->AddRGBPoint(dLevel + dWindow, ...);
m_pColorTransferFunction->AddRGBPoint(dLevel + dWindow, ...);
m_pColorTransferFunction->AddRGBPoint(dLevel + dWindow, ...);
m_pColorTransferFunction->AddRGBPoint(dLevel + dWindow, ...);

m_pVolumeScalarOpacity->AddPoint(...);
m_pVolumeScalarOpacity->AddPoint(...);

m_pVolumeMapper->SetBlendModeToComposite();
m_pVolumeProperty->ShadeOn();
m_pVolumeProperty->SetAmbient(...);
m_pVolumeProperty->SetDiffuse(...);
m_pVolumeProperty->SetSpecular(...);
m_pVolumeProperty->SetSpecularPower(...);
m_pVolumeProperty->SetScalarOpacityUnitDistance(...);
m_pVolume->Update();

And warning is:

Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeRGBTable.h, line 144
vtkObject (000001C50A0FE410): This OpenGL implementation does not support the required texture size of 32768, falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

The fact is that this warning is present on some dWindow -13, and dLevel 1183 … just an example … why I got this warning ?

Hi Flaviu, please provide all of the actual values you used for the ColorTransferFunction and the ScalarOpacity when the error occurred.

1 Like

I suspect that this error occurs when the value of dWindow is zero. Are you certain that dWindow is always positive in your program?

Edit: you should definitely add some code to make sure that dWindow is never zero or negative.

I have limited by code the value of Window, but that warning persist:

d:\project\MyApp\MyAppview.cpp(432) : atlTraceGeneral - Window: 1.000000	Level: 785.000000
Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeOpacityTable.h, line 191
vtkObject (000001B2F78DFC00): This OpenGL implementation does not support the required texture size of 32768. Falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeRGBTable.h, line 144
vtkObject (000001B2F78DF050): This OpenGL implementation does not support the required texture size of 262144, falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeOpacityTable.h, line 191
vtkObject (000001B2F78DFC00): This OpenGL implementation does not support the required texture size of 32768. Falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

d:\project\MyApp\MyAppview.cpp(432) : atlTraceGeneral - Window: 1.000000	Level: 785.000000
Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeOpacityTable.h, line 191
vtkObject (000001B2F78DF940): This OpenGL implementation does not support the required texture size of 32768. Falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeRGBTable.h, line 144
vtkObject (000001B2F78E0650): This OpenGL implementation does not support the required texture size of 262144, falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

Warning: In d:\vtk\vtk-8.2.0\rendering\volumeopengl2\vtkOpenGLVolumeOpacityTable.h, line 191
vtkObject (000001B2F78DF940): This OpenGL implementation does not support the required texture size of 32768. Falling back to maximum allowed, 16384.This may cause an incorrect color table mapping.

I looked through the code to see how the size of the lookup table texture is calculated. It’s calculated by vtkColotTransferFunction->EstimateMinumberOfSamples() according to the following formula:

    size = ceil((x2 - x1) / d)

where x1 and x2 are the minimum and maximum values in your data, and d is the minimum distance between points in the transfer function.

So for you, d is dWindow * 0.05 because that’s the smallest step that you use in the transfer function.

What is the range (max - min) of your data?

For example, if the range of your data is 4095, and if your GPU has a maximum texture size of 16384, then in order to avoid the warning the value of d must be 0.25 or greater. Hence, the value of dWindow must be 5 or higher.

If the range of your data is 65535, then dWindow must be 80 or higher in order to avoid the warning.

I’m not very familiar with this part of the VTK code, but my best guess is that the authors of this code assumed that the TransferFunction would usually cover most of the data range rather than just a small window.

1 Like