Suppose I format a renderbuffer
like so:
假设我像这样格式化一个renderbuffer:
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_R32UI, imageWidth, imageHeight);
where sampleCount >= 2.
And suppose I attach it to an FBO, draw some stuff into it, blit it to a non-multisampled FBO to resolve the multisampling, and finally call glReadPixels to get back some unsigned integers (one per pixel) from the resulting image.
假设我将它附加到FBO,将一些东西放入其中,将其blit到非多采样FBO以解析多重采样,最后调用glReadPixels从结果图像中取回一些无符号整数(每个像素一个)。
What integers will I get?
我会得到什么整数?
Might some of them be a blend of multiple samples, or is only one sample per pixel chosen in this case (presumably because an integer-based format is not considered to be blendable in this context), with the other samples being discarded? Or does something else happen?
其中一些可能是多个样本的混合,或者在这种情况下每个像素只选择一个样本(可能是因为基于整数的格式在这种情况下不被认为是可混合的),而其他样本被丢弃了?还是会发生其他事情?
1 个解决方案
#1
On page 511 of the OpenGL 4.5 spec, under section 18.3.1 "Blitting Pixel Rectangles", it says (emphasis added):
在OpenGL 4.5规范的第511页上,在第18.3.1节“Blitting Pixel Rectangles”下,它说(强调添加):
If the read framebuffer is multisampled (its effective value of SAMPLE_BUFFERS is one) and the draw framebuffer is not (its value of SAMPLE_BUFFERS is zero), the samples corresponding to each pixel location in the source are converted to a single sample before being written to the destination. filter is ignored. If the source formats are integer types or stencil values, a single sample’s value is selected for each pixel.
如果读取帧缓冲区是多重采样的(其有效值SAMPLE_BUFFERS为1)且绘制帧缓冲区不是(其SAMPLE_BUFFERS的值为零),则对应于源中每个像素位置的样本在写入之前将转换为单个样本目的地。过滤器被忽略。如果源格式是整数类型或模板值,则为每个像素选择单个样本的值。
So it choses one sample per pixel, without specifying which of the samples.
因此,每个像素选择一个样本,而不指定哪个样本。
#1
On page 511 of the OpenGL 4.5 spec, under section 18.3.1 "Blitting Pixel Rectangles", it says (emphasis added):
在OpenGL 4.5规范的第511页上,在第18.3.1节“Blitting Pixel Rectangles”下,它说(强调添加):
If the read framebuffer is multisampled (its effective value of SAMPLE_BUFFERS is one) and the draw framebuffer is not (its value of SAMPLE_BUFFERS is zero), the samples corresponding to each pixel location in the source are converted to a single sample before being written to the destination. filter is ignored. If the source formats are integer types or stencil values, a single sample’s value is selected for each pixel.
如果读取帧缓冲区是多重采样的(其有效值SAMPLE_BUFFERS为1)且绘制帧缓冲区不是(其SAMPLE_BUFFERS的值为零),则对应于源中每个像素位置的样本在写入之前将转换为单个样本目的地。过滤器被忽略。如果源格式是整数类型或模板值,则为每个像素选择单个样本的值。
So it choses one sample per pixel, without specifying which of the samples.
因此,每个像素选择一个样本,而不指定哪个样本。