Game Development Reference
In-Depth Information
Like the
Texture
object,
RenderTexture
has to stay alive as long as an object is us-
ing its internal texture. Otherwise the inner texture will get destroyed as well and the re-
source is lost.
Apart from the drawing functionality, the
RenderTexture
class has some of the
Tex-
ture
methods as well, such as
RenderTexture::setSmooth()
and
Render-
Texture::setRepeated()
. Also, if we want to start rendering to a render texture
using OpenGL, we have to call
RenderTexture::setActive()
to enable the con-
text for the OpenGL API calls. Otherwise, all the OpenGL calls will affect the previously
enabled context (in most cases it will be the main window).
We are done talking about the
RenderTexture
objects for now. We will come back to
them later on, when we have a firm understanding of shaders.