MCPcopy Create free account
hub / github.com/SFML/SFML / resize

Method resize

src/SFML/Graphics/RenderTexture.cpp:68–105  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

66
67////////////////////////////////////////////////////////////
68bool RenderTexture::resize(Vector2u size, const ContextSettings& settings)
69{
70 // Create the texture
71 // Set texture to be in sRGB scale if requested
72 if (!m_texture.resize(size, settings.sRgbCapable))
73 {
74 err() << "Impossible to create render texture (failed to create the target texture)" << std::endl;
75 return false;
76 }
77
78 // We disable smoothing by default for render textures
79 setSmooth(false);
80
81 // Create the implementation
82 if (priv::RenderTextureImplFBO::isAvailable())
83 {
84 // Use frame-buffer object (FBO)
85 m_impl = std::make_unique<priv::RenderTextureImplFBO>();
86
87 // Mark the texture as being a framebuffer object attachment
88 m_texture.m_fboAttachment = true;
89 }
90 else
91 {
92 // Use default implementation
93 m_impl = std::make_unique<priv::RenderTextureImplDefault>();
94 }
95
96 // Initialize the render texture
97 // We pass the actual size of our texture since OpenGL ES requires that all attachments have identical sizes
98 if (!m_impl->create(m_texture.m_actualSize, m_texture.m_texture, settings))
99 return false;
100
101 // We can now initialize the render target part
102 RenderTarget::initialize();
103
104 return true;
105}
106
107
108////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 3

initializeFunction · 0.85
isAvailableFunction · 0.50
createMethod · 0.45

Tested by

no test coverage detected