///////////////////////////////////////////////////////
| 140 | |
| 141 | //////////////////////////////////////////////////////////// |
| 142 | bool RenderTextureImplFBO::create(Vector2u size, unsigned int textureId, const ContextSettings& settings) |
| 143 | { |
| 144 | // Store the dimensions |
| 145 | m_size = size; |
| 146 | |
| 147 | { |
| 148 | const TransientContextLock lock; |
| 149 | |
| 150 | // Make sure that extensions are initialized |
| 151 | ensureExtensionsInit(); |
| 152 | |
| 153 | if (settings.antiAliasingLevel && !(GLEXT_framebuffer_multisample && GLEXT_framebuffer_blit)) |
| 154 | return false; |
| 155 | |
| 156 | m_sRgb = settings.sRgbCapable && GL_EXT_texture_sRGB; |
| 157 | |
| 158 | #ifndef SFML_OPENGL_ES |
| 159 | |
| 160 | // Check if the requested anti-aliasing level is supported |
| 161 | if (settings.antiAliasingLevel) |
| 162 | { |
| 163 | GLint samples = 0; |
| 164 | glCheck(glGetIntegerv(GLEXT_GL_MAX_SAMPLES, &samples)); |
| 165 | |
| 166 | if (settings.antiAliasingLevel > static_cast<unsigned int>(samples)) |
| 167 | { |
| 168 | err() << "Impossible to create render texture (unsupported anti-aliasing level)" |
| 169 | << " Requested: " << settings.antiAliasingLevel << " Maximum supported: " << samples << std::endl; |
| 170 | return false; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | #endif |
| 175 | |
| 176 | if (!settings.antiAliasingLevel) |
| 177 | { |
| 178 | // Create the depth/stencil buffer if requested |
| 179 | if (settings.stencilBits && settings.depthBits) |
| 180 | { |
| 181 | if (!GLEXT_packed_depth_stencil) |
| 182 | { |
| 183 | err() << "Impossible to create render texture (combined depth/stencil buffer not supported)" |
| 184 | << std::endl; |
| 185 | return false; |
| 186 | } |
| 187 | |
| 188 | GLuint depthStencil = 0; |
| 189 | glCheck(GLEXT_glGenRenderbuffers(1, &depthStencil)); |
| 190 | m_depthStencilBuffer = depthStencil; |
| 191 | if (!m_depthStencilBuffer) |
| 192 | { |
| 193 | err() << "Impossible to create render texture (failed to create the attached depth/stencil buffer)" |
| 194 | << std::endl; |
| 195 | return false; |
| 196 | } |
| 197 | glCheck(GLEXT_glBindRenderbuffer(GLEXT_GL_RENDERBUFFER, m_depthStencilBuffer)); |
| 198 | glCheck(GLEXT_glRenderbufferStorage(GLEXT_GL_RENDERBUFFER, |
| 199 | GLEXT_GL_DEPTH24_STENCIL8, |
nothing calls this directly
no test coverage detected