25#ifndef SFML_TEXTURE_HPP
26#define SFML_TEXTURE_HPP
31#include <SFML/Graphics/Export.hpp>
32#include <SFML/Graphics/Image.hpp>
33#include <SFML/Window/GlResource.hpp>
97 bool create(
unsigned int width,
unsigned int height);
278 void update(
const Uint8* pixels,
unsigned int width,
unsigned int height,
unsigned int x,
unsigned int y);
605 static unsigned int getValidSize(
unsigned int size);
614 void invalidateMipmap();
621 unsigned int m_texture;
625 mutable bool m_pixelsFlipped;
626 bool m_fboAttachment;
Base class for classes that require an OpenGL context.
Class for loading, manipulating and saving images.
Base class for all render targets (window, texture, ...)
Target for off-screen 2D rendering into a texture.
Graphical text that can be drawn to a render target.
Image living on the graphics card that can be used for drawing.
void update(const Image &image)
Update the texture from an image.
static unsigned int getMaximumSize()
Get the maximum texture size allowed.
void setSmooth(bool smooth)
Enable or disable the smooth filter.
void update(const Uint8 *pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y)
Update a part of the texture from an array of pixels.
void update(const Window &window, unsigned int x, unsigned int y)
Update a part of the texture from the contents of a window.
bool loadFromMemory(const void *data, std::size_t size, const IntRect &area=IntRect())
Load the texture from a file in memory.
Texture()
Default constructor.
bool isSmooth() const
Tell whether the smooth filter is enabled or not.
Texture(const Texture ©)
Copy constructor.
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the texture.
bool generateMipmap()
Generate a mipmap using the current texture data.
Image copyToImage() const
Copy the texture pixels to an image.
bool loadFromStream(InputStream &stream, const IntRect &area=IntRect())
Load the texture from a custom stream.
void update(const Image &image, unsigned int x, unsigned int y)
Update a part of the texture from an image.
bool create(unsigned int width, unsigned int height)
Create the texture.
void update(const Texture &texture, unsigned int x, unsigned int y)
Update a part of this texture from another texture.
bool loadFromFile(const std::string &filename, const IntRect &area=IntRect())
Load the texture from a file on disk.
void swap(Texture &right)
Swap the contents of this texture with those of another.
bool isSrgb() const
Tell whether the texture source is converted from sRGB or not.
Vector2u getSize() const
Return the size of the texture.
CoordinateType
Types of texture coordinates that can be used for rendering.
@ Normalized
Texture coordinates in range [0 .. 1].
void setRepeated(bool repeated)
Enable or disable repeating.
bool loadFromImage(const Image &image, const IntRect &area=IntRect())
Load the texture from an image.
void update(const Window &window)
Update the texture from the contents of a window.
void update(const Uint8 *pixels)
Update the whole texture from an array of pixels.
static void bind(const Texture *texture, CoordinateType coordinateType=Normalized)
Bind a texture for rendering.
bool isRepeated() const
Tell whether the texture is repeated or not.
void setSrgb(bool sRgb)
Enable or disable conversion from sRGB.
void update(const Texture &texture)
Update a part of this texture from another texture.
Window that serves as a target for OpenGL rendering.