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.
            Asked
            
        
        
            Active
            
        
            Viewed 1,362 times
        
    2 Answers
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
 
- 
                    He's not talking about textures. He's talking about Image Load/Store. That's why he said `image2D` and not `texture2D`. – Nicol Bolas May 29 '13 at 14:45
 - 
                    Ohh, my bad, I misread the question ! (which is sad, because it heavily insisted on image2D) – Calvin1602 May 29 '13 at 15:07
 - 
                    I can blit without shader as well ;) – Michael IV May 29 '13 at 15:38