Is it possible to set MSAA sampling for image2D? Can it be of multisampled type as texture2D in OpenGL? I am writing first pass not to a render buffer (or texture) but to image where I store several pixel copies of the same primitive but at different offsets.Then I blit it to the main window frame buffer.The output has a strong aliasing and I wonder if it's possible to make the first pass to use MSAA.
GLSL image2D antialiasing
1.4k Views Asked by Michael IV At
2
There are 2 best solutions below
3

Yes, use glTexImage2DMultisample
instead of glTexImage2D
for your render-to-texture target.
In the shader that you use for blitting the texture to the screen, use a sampler2DMS
instead of a sampler2D
, and texelFetch
instead of texture2D
.
You'll have to call texelFetch
several times, one per sample, and average yourself.
No, an
image2D
cannot be multisampled.An
image2DMS
can however; indeed, it must. Remember: multisample textures represent a fundamentally different texture type from 2D textures. They're just as different from 2D textures as 3D textures are.