NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

wglGetProcAddress() failed for 'glTexImage3D' #39

Closed Tom-Zheng closed 3 years ago

Tom-Zheng commented 3 years ago

Hi, I'm seeing this error using both tensorflow and pytorch versions of nvdiffrast:

(test) PS F:\projects\lib\nvdiffrast\samples\torch> python .\triangle.py
[F C:\Miniconda\envs\test\lib\site-packages\nvdiffrast\common\glutil.cpp:66] wglGetProcAddress() failed for 'glTexImage3D'

My environment is :

Since I'm using an Azure server through remote desktop, I'm wondering if this is because I have no physical monitors connect to the GPU? If so, what can I do to make it run headlessly?

s-laine commented 3 years ago

The error message suggests that you don't have proper hardware-accelerated OpenGL available. This is probably because of the headless setup, as you suspect.

We have no experience with running under Azure, unfortunately. Based on this help page it appears to be possible to run hardware-accelerated OpenGL in Azure, and that should be enough to get nvdiffrast to work, I believe.

To help in debugging, you can add dr.set_log_level(0) at the beginning of your program. This should show a bit more information about the OpenGL driver as it is being initialized.

Tom-Zheng commented 3 years ago

Still no luck after I turned on GPU rendering of remote desktop. This is the detailed log:

(test) PS F:\projects\lib\nvdiffrast\samples\torch> python .\triangle.py
[I C:\Miniconda\envs\test\lib\site-packages\nvdiffrast\common\glutil.cpp:119] Creating GL context for Cuda device 0
[I C:\Miniconda\envs\test\lib\site-packages\nvdiffrast\common\glutil.cpp:127] Selecting device with PCI bus id 0001:00:00.0 - success
[I C:\Miniconda\envs\test\lib\site-packages\nvdiffrast\common\glutil.cpp:164] WGL OpenGL context created (hdc: 0x1001078c, hglrc: 0x00010000)
[F C:\Miniconda\envs\test\lib\site-packages\nvdiffrast\common\glutil.cpp:66] wglGetProcAddress() failed for 'glTexImage3D'
s-laine commented 3 years ago

The error indicates that function glTexImage3D which is part of OpenGL 1.2 specification is not found by the extension loader. This would be consistent with having only OpenGL 1.1 available, which is what Windows offers in remote desktop sessions by default.

I cannot debug this myself, as I don't have an Azure installation to work with, but there is further information available in this StackOverflow post and replies. In addition, there is a software tool that should enable native OpenGL in remote desktop sessions, which sounds quite promising — if the problem is indeed with the availability of OpenGL. Some articles mention a program called OpenGL Extensions Viewer (GLview) that might help in diagnosing the problem, but I don't know anything about that utility myself.

If you manage to find a working solution, please let me know so that I can update the documentation accordingly.