Multisample Texture: Difference between revisions
Jump to navigation
Jump to search
m moved Multisample Textures to Multisample Texture: de-pluralizing, per Wikipedia standard. |
No edit summary |
||
Line 1: | Line 1: | ||
A '''Multisample Texture''' is a [[Texture]] that can have multiple samples per pixel. This allows them to be used as [[Multisampling|multisample]] render targets | A '''Multisample Texture''' is a [[Texture]] that can have multiple samples per pixel. This allows them to be used as [[Multisampling|multisample]] render targets and also as source data for [[Shader|shaders]]. | ||
As you would use glTexImage2D , here we can use glTexImage2DMultisample. | |||
Primary use is for creating Frame buffers and providing them support for multi sampling: | |||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, t); | |||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGB, w, h, GL_TRUE); | |||
Now you may use this texture with your Frame buffer object: | |||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, t, 0); | |||
Similar functions are provided for using multisample render buffer with your frame buffer: e.g.: '''glRenderbufferStorageMultisample''' | |||
You may use '''glBlitFramebuffer''' to copy this Frame buffer to any regular frame buffer. | |||
[[Category:Textures]] | [[Category:Textures]] |
Revision as of 07:04, 13 May 2021
A Multisample Texture is a Texture that can have multiple samples per pixel. This allows them to be used as multisample render targets and also as source data for shaders.
As you would use glTexImage2D , here we can use glTexImage2DMultisample. Primary use is for creating Frame buffers and providing them support for multi sampling:
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, t); glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGB, w, h, GL_TRUE);
Now you may use this texture with your Frame buffer object:
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, t, 0);
Similar functions are provided for using multisample render buffer with your frame buffer: e.g.: glRenderbufferStorageMultisample
You may use glBlitFramebuffer to copy this Frame buffer to any regular frame buffer.