[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

pygame.camera bit depth (Was "Re: [pygame] Speed up image.tostring with OpenGL ?")



Hello again,

I'm trying to ask again : Is there a way to grab an image from the
camera module that has a bit depth different from 24 bits?

Alexandre Quessy wrote:
> René Dudfield wrote:
>> # something like this... untested.
>> w,h = surf.get_size()
>> data = pygame.surfarray.pixels2d(surf)
>> texture = glGenTextures(1)
>> glBindTexture(GL_TEXTURE_2D, texture)
>> glPixelStorei(GL_UNPACK_ALIGNMENT,1)
>> glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data)
>> # ... etc...
> 
> 
> Since I am reading from the pygame.camera.Camera, the image has a 24 bit
> depth. This format is the only one that is not supported by
> surfarray.pixels2d. Can I change the format that the Camera gives me ?
> 


Thanks !

a