@newateverything wrote:
Hi all,
I get a reference (from an ofImage) to the pixel data directly on a cpu thread, update the pixels and then call update on the GPU thread to create the texture. All is working fine, however, the Red and Blue colors are flipped for me.
The image is setup as OF_IMAGE_COLOR_ALPHA, and the (received) raw bitmap data has the following properties:
bpp = 32
depth = 32
bigEndian = 0 // is little endian
red, blue & green max is 255
red shift, green shift and blue shift are 16,8 and 0 respectively.
trueColor = trueI have verified that the ofImage created has an internal pixel format of RGBA. Below is data from ofPixels in the image:
06-24 18:36:25.914: V/ofxFramebuffer(2115): Image type: 2 // OF_IMAGE_COLOR_ALPHA
06-24 18:36:25.914: V/ofxFramebuffer(2115): Image bpp: 32
06-24 18:36:25.914: V/ofxFramebuffer(2115): Image bitsPerChannel: 8
06-24 18:36:25.919: V/ofxFramebuffer(2115): Image BytesPerPixel: 4
06-24 18:36:25.919: V/ofxFramebuffer(2115): Image PixelFormat: 4 // RGBANote: the bitmaps in my case are coming from a VNC server where we set the following PixelFormat:
06-24 18:36:25.699: V/ServerInfo(2115): ******* Logging Pixel Format ******
06-24 18:36:25.699: V/ServerInfo(2115): ss bbp: 32
06-24 18:36:25.699: V/ServerInfo(2115): ss depth: 32
06-24 18:36:25.699: V/ServerInfo(2115): ss bigEndian: 0
06-24 18:36:25.699: V/ServerInfo(2115): ss trueColor: 1
06-24 18:36:25.699: V/ServerInfo(2115): ss redMax: 255
06-24 18:36:25.699: V/ServerInfo(2115): ss greenMax: 255
06-24 18:36:25.699: V/ServerInfo(2115): ss blueMax: 255
06-24 18:36:25.699: V/ServerInfo(2115): ss redShift: 16
06-24 18:36:25.699: V/ServerInfo(2115): ss greenShift: 8
06-24 18:36:25.699: V/ServerInfo(2115): ss blueShift: 0
06-24 18:36:25.699: V/ServerInfo(2115): ******* End Pixel Format log ******The copy process (from unsigned char * received) is identical to bitmaps that I receive from an RDP server (which is another part of the client), and the RDP buffer does not swap the red and blue.
The copy function is below for reference:
register int bpp = theBPP; register int fbwidth = _vclient->drawBuffer->getWidth(); register int recth = somerect.h, rectw = somerect.w; register unsigned char *fastsrc = src; register char *fastdest = dest + bpp * somerect.y * fbwidth + bpp * somerect.x; register int rowsleft = recth, rowlength = bpp*rectw, fbmissingwidth = bpp*fbwidth; while (rowsleft--) { bcopy(fastsrc, fastdest, rowlength); fastsrc+=rowlength; fastdest+=fbmissingwidth; }
dest
is a pointer to the pixelData.src
is the unsigned char array received from VNC.drawBuffer
is an instance of ofImageAm I doing something obviously wrong?
Please note: this is on Android.
Thank you for any advice!
Posts: 5
Participants: 2