ahmedali
22-09-2007 10:31:31
I proves to be that no matter which Pixel Format I use they all behave like PF_BYTE_BGRA only.
Surprisingly no matter which BYTE* pixel format I use they all give me the same result as PF_BYTE_BGRA. Even using PF_BYTE_RGBA does not swap Red and Blue.

However if I use 3 pixels and skip alpha copying. The image results in this. So it only works right if I assume the pixel format is BGRA.

Is there any problem with binding problem pixel formats enums.
pointer = pixelBuffer.lock(0,width*height,ogre.HardwareBuffer.HBL_NORMAL)
#number 4 here is use to accommodate the bytes for r, g, b, a may vary with different pixel formats
storageclass = ctypes.c_uint8 * (width*height*4)
cbuffer=storageclass.from_address(ogre.CastInt(pointer))
pos = 0
for x in range(height*width):
cbuffer[pos] = dataArray[x][2]
pos += 1
cbuffer[pos] = dataArray[x][1]
pos += 1
cbuffer[pos] = dataArray[x][0]
pos += 1
cbuffer[pos] = 1
pos += 1
Surprisingly no matter which BYTE* pixel format I use they all give me the same result as PF_BYTE_BGRA. Even using PF_BYTE_RGBA does not swap Red and Blue.
However if I use 3 pixels and skip alpha copying. The image results in this. So it only works right if I assume the pixel format is BGRA.
Is there any problem with binding problem pixel formats enums.