Hello. I have a question.
But first, here is the context:
I wanted to render to multiple targets in my OpenGL application, where my second target is a floating-point renderbuffer (or texture) of internal format R32F. But I had a problem that rendering to that second floating-point attachment was not happening at all (by a call to glDrawElements
, for example), but clearing that attachment was working perfectly fine (glCearBufferfv
, for example).
Then, after some searching on forums, I found this thread that was similar to my problem and I found that the problem was that I had blending enabled and that was messing up drawing to the second attachment. I fixed the problem and now everything seems to work fine.
But still I have a problem: before disabling blending, on my desktop computer drawing to the second attachment was not working at all, as if it was blocked by a call to glColorMaski(1, ...)
or by not specifying the second attachment in glDrawBuffers
. I knew that it was not working at all, because I run the application tens of times in RenderDoc and I saw everything (not quite; limited by my knowledge) that was happening, and because every frame I was reading from that attachment with glReadPixels
(because that was the application supposed to do). But on my laptop, glReadPixels
was returning apparently undefined data. It was returning either the correct float values that was supposed to read and return, either some negative, random float, either the clear value, which is 0. On the desktop computer it was always returning the clear value. So, the exact same application, same code and GL_BLEND
enabled was behaving differently, which seems to me undefined behaviour.
My question is: was it undefined behavior, or there was a bug in one of the OpenGL implementations, or something else? Why there were two results, if there was no UB?
Desktop computer: Ubuntu 22.04.1, OpenGL 4.3, NVIDIA GeForce GTX 1050, driver 515.65.01
Laptop: Xubuntu 22.04.1, OpenGL 4.6, Intel HD Graphics 4400 (HSW GT2), Mesa 22.0.5
I can show the mostly raw OpenGL commands I call, or any other details I know, if it helps. Hope I was clear enough.