我正在使用Glumpy并尝试将纹理绑定为GL_RGB32F
。它似乎将纹理绑定为GL_RGB
,即使我的numpy数组是np.float32
类型。这个数组包含的值超出了0..1范围,我需要在片段着色器unclipped中使用这些值。你知道吗
compute = gloo.Program(compute_vertex, compute_fragment, count=4)
compute["matte"] = matte
compute["matte"].interpolation = gl.GL_NEAREST
compute["matte"].wrapping = gl.GL_CLAMP_TO_EDGE
compute["distanceField"] = alpha
compute["distanceField"].interpolation = gl.GL_NEAREST
compute["distanceField"].wrapping = gl.GL_CLAMP_TO_EDGE
compute["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
compute["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
print(matte.dtype)
print(gl.GL_RGB32F)
print(compute["matte"].gpu_format)
print(compute["distanceField"].gpu_format)
输出为
float32
GL_RGB32F (34837)
GL_RGB (6407)
GL_RED (6403)
如何将matte
数组绑定为GL_RGB32F
,将distanceField
绑定为GL_R32F
?你知道吗
找到了答案。在numpy数组上使用
view(gloo.TextureFloat2D)
,否则,它会在内部自动调用view(Texture2D)
。你知道吗相关问题 更多 >
编程相关推荐