Multisample Texture: Difference between revisions
Added linking, formatting, and improved descriptions. |
mNo edit summary |
||
Line 5: | Line 5: | ||
There are only two multisampled texture targets: 2D textures, and 2D array textures ({{enum|GL_TEXTURE_2D_MULTISAMPLE}} and {{enum|GL_TEXTURE_2D_ARRAY_MULTISAMPLE}} respectively). | There are only two multisampled texture targets: 2D textures, and 2D array textures ({{enum|GL_TEXTURE_2D_MULTISAMPLE}} and {{enum|GL_TEXTURE_2D_ARRAY_MULTISAMPLE}} respectively). | ||
Creating a multisample texture requires using {{apifunc|glTexStorage2DMultisample}}, {{apifunc|glTexStorage3DMultisample}} for 2D array textures (or the {{code|glTexImage*Multisample}} equivalents: | Creating a multisample texture requires using {{apifunc|glTexStorage2DMultisample}}, {{apifunc|glTexStorage3DMultisample}} for 2D array textures (or the {{code|glTexImage*Multisample}} equivalents): | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> |
Latest revision as of 14:01, 28 December 2021
A Multisample Texture is a Texture that can have multiple samples per pixel, thereby allowing it to be used in multisampled rendering. As they are textures, their multiple samples can also be fetched from shaders.
This article is a stub. You can help the OpenGL Wiki by expanding it. |
There are only two multisampled texture targets: 2D textures, and 2D array textures (GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_ARRAY_MULTISAMPLE respectively).
Creating a multisample texture requires using glTexStorage2DMultisample, glTexStorage3DMultisample for 2D array textures (or the glTexImage*Multisample equivalents):
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, w, h, GL_TRUE);
//Attach to an FBO:
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0);
Similar functions are provided for using multisample render buffer with your frame buffer: e.g.: glRenderbufferStorageMultisample
You may use glBlitFramebuffer to perform a multisample resolve operation by copying to a non-multisampled framebuffer object.