diff --git a/easyvolcap/runners/volumetric_video_viewer.py b/easyvolcap/runners/volumetric_video_viewer.py index 452639a..2bb9c50 100644 --- a/easyvolcap/runners/volumetric_video_viewer.py +++ b/easyvolcap/runners/volumetric_video_viewer.py @@ -1470,6 +1470,12 @@ def init_glfw(self): # Create a windowed mode window and its OpenGL context window = glfw.create_window(self.W, self.H, self.window_title, None, None) + if window is None: + glfw.terminate() + log(red('Could not initialize window')) + raise RuntimeError('Failed to initialize window in glfw') + + # Setting up the window glfw.make_context_current(window) glfw.swap_interval(self.use_vsync) # disable vsync @@ -1478,10 +1484,5 @@ def init_glfw(self): height, width = icon.shape[:2] glfw.set_window_icon(window, 1, [width, height, pixels]) # set icon for the window - if not window: - glfw.terminate() - log(red('Could not initialize window')) - raise RuntimeError('Failed to initialize window in glfw') - self.window = window cfg.window = window # MARK: GLOBAL VARIABLE diff --git a/easyvolcap/utils/gl_utils.py b/easyvolcap/utils/gl_utils.py index 4dc949f..13e5a7d 100644 --- a/easyvolcap/utils/gl_utils.py +++ b/easyvolcap/utils/gl_utils.py @@ -581,7 +581,7 @@ def init_texture(self): def copy_to_texture(self, image: torch.Tensor, x: int = 0, y: int = 0, w: int = 0, h: int = 0): if not self.use_quad_cuda: - self.upload_to_texture(image) + self.upload_to_texture(image, x, y, w, h) return if not hasattr(self, 'cu_tex'): @@ -647,7 +647,7 @@ def upload_to_texture(self, ptr: np.ndarray, x: int = 0, y: int = 0, w: int = 0, ptr = ptr.detach().cpu().numpy() # slow sync and copy operation # MARK: SYNC gl.glBindTexture(gl.GL_TEXTURE_2D, self.tex) - gl.glTexSubImage2D(gl.GL_TEXTURE_2D, 0, x, y, w, h, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, ptr[y:h, x:w]) # to gpu, might slow down? + gl.glTexSubImage2D(gl.GL_TEXTURE_2D, 0, x, y, w, h, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, ptr) # to gpu, might slow down? @property def verts_data(self): # a heavy copy operation @@ -1319,9 +1319,10 @@ def init_gl_buffers(self, v: int = 0, f: int = 0): try: self.cu_vbo = CHECK_CUDART_ERROR(cudart.cudaGraphicsGLRegisterBuffer(self.vbo, flags)) except RuntimeError as e: - log(red(f'Your system does not support CUDA-GL interop, please use pytorch3d\'s implementation instead')) + log(red(f'Your system does not support CUDA-GL interop, will use pytorch3d\'s implementation instead')) log(red(f'This can be done by specifying {blue("model_cfg.sampler_cfg.use_cudagl=False model_cfg.sampler_cfg.use_diffgl=False")} at the end of your command')) log(red(f'Note that this implementation is extremely slow, we recommend running on a native system that support the interop')) + log(red(f'An alternative is to install diff_point_rasterization and use the approximated tile-based rasterization, enabled by the `render_gs` switch')) # raise RuntimeError(str(e) + ": This unrecoverable, please read the error message above") raise e