Skip to content

Commit 72e63a7

Browse files
authored
Fix glDrawPixels error in Python visualizer (#66)
1 parent 89b6316 commit 72e63a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/cli/visualization/visualizer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@ def __render(self, cameraPose, width, height, image=None, colorFormat=None):
352352
if self.cameraMode == CameraMode.AR:
353353
if image is not None:
354354
# draw AR background
355-
glDrawPixels(width, height, GL_LUMINANCE if colorFormat == spectacularAI.ColorFormat.GRAY else GL_RGB, GL_UNSIGNED_BYTE, image.data)
355+
glDrawPixels(
356+
width,
357+
height,
358+
GL_LUMINANCE if colorFormat == spectacularAI.ColorFormat.GRAY else GL_RGB,
359+
GL_UNSIGNED_BYTE,
360+
np.frombuffer(image.data, dtype=np.uint8))
356361
viewMatrix = cameraPose.getWorldToCameraMatrix()
357362
projectionMatrix = cameraPose.camera.getProjectionMatrixOpenGL(near, far)
358363
if self.args.flip: projectionMatrix = np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) @ projectionMatrix

0 commit comments

Comments
 (0)