i have some doubts with multisampled textures.

In fragment shader, how to pass multiple samples?

We use glTexImage2DMultisample instead of glTeximage2D. so, how to upload texture data?

I want to use default FBO for this.


1 Answer 1


It is not possible to directly use a multisampled texture. You have to resolve it to another texture (same format, same size) first.

You can do that by binding the non-multisampled texture and blitting the multisampled one to it with glBlitFramebuffer (you might need to append EXT to function name - use glBlitFramebufferEXT - if you use OpenGL 2).

  • \$\begingroup\$ Can you please provide more details? \$\endgroup\$ Commented Dec 27, 2012 at 13:52
  • 1
    \$\begingroup\$ @Roshan More details on what, exactly? \$\endgroup\$
    – snake5
    Commented Dec 27, 2012 at 13:56
  • \$\begingroup\$ You mean render to texture? also, what will be the fragment shader for multisampled textures? \$\endgroup\$ Commented Dec 27, 2012 at 15:34
  • \$\begingroup\$ 1) Render to texture - what? Binding a buffer and changing some pixels via draw calls / blitting is "render to texture". Not sure how that changes anything, though. 2) There is no "fragment shader for multisampled textures". Drawing to a multisampled texture generally doesn't require shader changes. And it is not allowed to use a multisampled texture in draw calls. \$\endgroup\$
    – snake5
    Commented Dec 27, 2012 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .