Re: [PyOpenGL-Users] glTexSubImage2D data format
Brought to you by:
mcfletch
From: Gijs <in...@bs...> - 2009-11-10 17:41:50
|
On 10-11-2009 18:07, Mohan Ganesalingam wrote: > Hi, > > I'm trying to port some very elementary GPGPU code (based on > http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html) to run > with Python(+PyOpenGL+pygame). I'm running into some difficulties > translating the following line... > > glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, > GL_LUMINANCE, GL_FLOAT, data) > > I think the problem is that I don't have 'data' in the right format. (I've > tried several things, including arrays and strings. In the original C code > it's just a float*.) Would anyone be able to tell me what the appropriate > format in Python would be? > > Thank you in advance, > Mohan > Hi Mohan, I usually use Numpy arrays for calls like this. So something like this: data = zeros(width*height, 'f')+0.5 glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, GL_LUMINANCE, GL_FLOAT, data) This should give all your texels a value of 0.5. Regards, Gijs |