GLReadBufferUtil.readPixelsImpl(..) uses 'hasAlpha' to determine the 'PixelFormat.Composition hostPixelComp' and then modifies it based on the 'GLPixelAttributes pixelAttribs' composition. Host and GL pixel composition could be different, however, this implementation could potentially lead to a different host storage on the second call w/ 'hasAlpha = true'. Either (1) store the 'requestedAlpha' immutable and use it always, or (2) determine 'hasAlpha' with construction. (2) probably is desired anyways and (1) for better documentation (debugging). Hence both options probably should be implemented and (2) will also lead to proper host PixelFormat. This erroneous behavior is now visible using AWTGLReadBufferUtil, which can be mitigated using 'hasAlpha = true' in the construction.
(In reply to Sven Gothel from comment #0) > Either (1) store the 'requestedAlpha' immutable and use it always, > or (2) determine 'hasAlpha' with construction. > > (2) probably is desired anyways and (1) for better documentation (debugging). > Hence both options probably should be implemented and (2) will also lead to > proper host PixelFormat. > > This erroneous behavior is now visible using AWTGLReadBufferUtil, > which can be mitigated using 'hasAlpha = true' in the construction. (2) 'hasAlpha' cannot be determined w/o a valid GL instance or at least GLProfile at construction, since none is currently passed in the constructor, we need to keep 'hasAlpha' being lazily evaluated by the first readPixel call. (1) immutable storage of requestedAlpha will resolve this issue It is up to the AWTGLReadBufferUtil user to use different pixel formats for host and GL, i.e. RGB stored within 32bit INT on the host side being filled by OpenGL with RGBA or BGRA data.
jogl 154e91978498d8b6db9ce34a1f06b298bcf4c361 Keep host PixelFormat functional using requested immutable alphaRequested + add appropriate API doc