I may get it : passing the numpy.array to texture seems to work through :

c_float_p = POINTER(c_float)

my_texture = np.random.uniform(0,1,(512, 512)).astype(np.float32) # 
generate random noise as test texture
my_texture_p = my_texture.ctypes.data_as(c_float_p)

my_texture_id = gl.GLuint() # generate 1 component texture (let's say ALPHA)
gl.glGenTextures(1, byref(my_texture_id))
gl.glEnable(gl.GL_TEXTURE_2D)
gl.glBindTexture(gl.GL_TEXTURE_2D, my_texture_id.value)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_ALPHA, 512, 512, 0,
                gl.GL_ALPHA, gl.GL_FLOAT, my_texture_p)


seems to work. Needs more test, but it's late...


On Saturday, August 17, 2013 7:03:04 PM UTC+2, Fred wrote:
>
> In the previous code, there's an obvious error in the fragment shader (a 
> 'vec4' is missing). Still not working though.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to