0

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.

jozxyqk
  • 16,424
  • 12
  • 91
  • 180
Michael IV
  • 11,016
  • 12
  • 92
  • 223

2 Answers2

1

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
0

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.

Calvin1602
  • 9,413
  • 2
  • 44
  • 55