diff --git a/easyvolcap/runners/volumetric_video_viewer.py b/easyvolcap/runners/volumetric_video_viewer.py index cf54822..1efc430 100644 --- a/easyvolcap/runners/volumetric_video_viewer.py +++ b/easyvolcap/runners/volumetric_video_viewer.py @@ -1401,7 +1401,6 @@ def init_camera(self, camera_cfg: dotdict = dotdict(), view_index: int = None): def init_quad(self): from easyvolcap.utils.gl_utils import Quad - from cuda import cudart self.quad = Quad(H=self.H, W=self.W, use_quad_cuda=self.use_quad_cuda, compose=self.compose, compose_power=self.compose_power) # will blit this texture to screen if rendered def init_opengl(self): diff --git a/easyvolcap/utils/gl_utils.py b/easyvolcap/utils/gl_utils.py index 13e5a7d..ccc59ed 100644 --- a/easyvolcap/utils/gl_utils.py +++ b/easyvolcap/utils/gl_utils.py @@ -567,13 +567,13 @@ def init_texture(self): gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, old_fbo) if self.use_quad_cuda: - from cuda import cudart - if self.compose: - # Both reading and writing of this resource is required - flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone - else: - flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard try: + from cuda import cudart + if self.compose: + # Both reading and writing of this resource is required + flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone + else: + flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard self.cu_tex = CHECK_CUDART_ERROR(cudart.cudaGraphicsGLRegisterImage(self.tex, gl.GL_TEXTURE_2D, flags)) except RuntimeError as e: log(red('Failed to initialize Quad with CUDA-GL interop, will use slow upload: '), e)