Access to 3D array in fragment shader
I'm trying to provide access to a 3-dimensional array of scalar data to a fragment shader, from a Python program using PyOpenGL. In the fragment shader, I declare the a 3d sampler uniform uniform sampler3D vol; and in the Python program I have the following code to set up a scalar 3d texture vol = numpy.random.rand(3, 3, 3).astype(np.float32) texture = glGenTextures(1) glUniform1i(glGetUniformLocation(program, "vol"), 0) glActiveTexture(GL_TEXTURE0 + 0) glBindTexture(GL_TEXTURE_3D, texture) glTexImage3D(GL_TEXTURE_3D, 0, GL_RED, 3, 3, 3, 0, GL_RED, GL_FLOAT, vol) glEnable(GL_TEXTURE_3D)