Is glDrawPixels
(Drawing pixels to the screen) pretty much the defacto way of displaying images in Blender’s viewport? If so, I appear to be getting horrible results (Black and white/no colors except tiny rainbow pixels all over the place) with the code below. Any chance you’d know how to do this better? (For getting Arnold’s IPR working within Blender’s “rendered” viewport)
(width, height), rect = ipr.update(width, height, data)
v = bgl.Buffer(bgl.GL_FLOAT, 4)
bgl.glGetFloatv(bgl.GL_VIEWPORT, v)
vw = v[2]
vh = v[3]
bgl.glRasterPos2f(0, vh - 1.0)
bgl.glPixelZoom(vw / width, -vh / height)
bgl.glDrawPixels(width, height, bgl.GL_RGBA, bgl.GL_FLOAT,
bgl.Buffer(bgl.GL_FLOAT, len(rect), rect))
bgl.glPixelZoom(1.0, 1.0)
bgl.glRasterPos2f(0, 0)
Using the above code for the IPR gives me this result in blender’s viewport: