BGRA only? No difference b/w PixelFomats? RGB BGR RGBA


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.

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)
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.


22-09-2007 15:14:33

Can you post the code that deals with the pixel format enum? Also did you take a look at the demo which does the pixel format manipulation?


22-09-2007 21:28:41

DOES NOT MATTER which PF_BYTE* I use, the final result is always ogre.PF_BYTE_BGRA. The code is based on a post in this form. That post uses PF_BYTE_BGRA too.

def make_tex(self):
## Test pixel stuff..
# Create the texture
texture = ogre.TextureManager.getSingleton().createManual(
"DynamicTexture", # name
ogre.TEX_TYPE_2D, # type
256, 256, # width & height
0, # number of mipmaps
# DOES NOT MATTER which PF_BYTE* I use, the result is
# always ogre.PF_BYTE_BGRA
ogre.PF_BYTE_RGB, # pixel format
# textures updated very often (e.g. each frame)

# Create a material using the texture
material = ogre.MaterialManager.getSingleton().create(
"MatTV", # name

return (material, texture)


22-09-2007 23:18:32

Are you sure your card supports the other Pixel Formats?. For me I have the same problem with my card for both C++ and python ogre as: ... =pfbytergb


23-09-2007 15:16:33

No need to shout. I was just trying to remove sources of error. I know there are some demos/samples that manipulate the pixels directly. They could of been using a different pixel format, and if they worked, it would just be a simple coding error on your part. That is also my reason for asking for a more complete code sample.

I believe a complete Ogre log shows the supported pixel formats for your card. Maybe you could check that.


28-09-2007 20:44:06

You guys are right my card (intel 945g dx9 compatible) doest support this format. I read a post on ogre which says pxiel formats fallbacks to next possible format incase orignal not found.

Anyhow this is what I was trying to acheive.
M.A.M.E (Arcade Emulator) and my TvTuner in PythonOgre