raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | List of all members
raylib::Texture Class Reference

Texture type. More...

Public Member Functions

 Texture (const Texture &)=delete
 Explicitly forbid the copy constructor.
 
 Texture (Texture &&other)
 Move constructor.
 
 ~Texture ()
 On destruction, unload the Texture.
 
Texture & operator= (const Texture &)=delete
 Explicitly forbid copy assignment.
 
Texture & operator= (Texture &&other) noexcept
 Move assignment.
 
 TextureUnmanaged ()
 Default texture constructor.
 
 TextureUnmanaged (::Texture &&other)
 
 TextureUnmanaged (const ::Image &image)
 Creates a texture from the given Image. More...
 
 TextureUnmanaged (const ::Image &image, int layout)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
 TextureUnmanaged (const ::Texture &texture)
 Creates a texture object based on the given Texture struct data.
 
 TextureUnmanaged (const std::string &fileName)
 Load texture from file into GPU memory (VRAM) More...
 
 TextureUnmanaged (unsigned int id, int width, int height, int mipmaps=1, int format=PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
 Move/Create a texture structure manually.
 
- Public Member Functions inherited from raylib::TextureUnmanaged
 TextureUnmanaged ()
 Default texture constructor.
 
 TextureUnmanaged (::Texture &&other)
 
 TextureUnmanaged (const ::Image &image)
 Creates a texture from the given Image. More...
 
 TextureUnmanaged (const ::Image &image, int layout)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
 TextureUnmanaged (const ::Texture &texture)
 Creates a texture object based on the given Texture struct data.
 
 TextureUnmanaged (const std::string &fileName)
 Load texture from file into GPU memory (VRAM) More...
 
 TextureUnmanaged (unsigned int id, int width, int height, int mipmaps=1, int format=PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
 Move/Create a texture structure manually.
 
void Draw (::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, ::Color tint={255, 255, 255, 255}) const
 Draws a texture (or part of it) that stretches or shrinks nicely. More...
 
void Draw (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, ::Color tint={255, 255, 255, 255}) const
 Draw a part of a texture defined by a rectangle with 'pro' parameters. More...
 
void Draw (::Rectangle sourceRec, ::Vector2 position={0, 0}, ::Color tint={255, 255, 255, 255}) const
 Draw a part of a texture defined by a rectangle. More...
 
void Draw (::Vector2 position, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D with position defined as Vector2. More...
 
void Draw (::Vector2 position, float rotation, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D with extended parameters. More...
 
void Draw (::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint={255, 255, 255, 255}) const
 Draw texture quad with tiling and offset parameters. More...
 
void Draw (int posX=0, int posY=0, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D. More...
 
void DrawBillboard (const ::Camera &camera, ::Rectangle source, ::Vector3 position, ::Vector2 size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture defined by source. More...
 
void DrawBillboard (const ::Camera &camera, ::Rectangle source, Vector3 position, ::Vector3 up, Vector2 size, Vector2 origin, float rotation=0.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture defined by source and rotation. More...
 
void DrawBillboard (const ::Camera &camera, ::Vector3 position, float size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture. More...
 
void DrawCube (::Rectangle source, ::Vector3 position, ::Vector3 dimensions, ::Color color={255, 255, 255, 255}) const
 Draw cube with a region of a texture, with dimensions. More...
 
void DrawCube (::Rectangle source, ::Vector3 position, float width, float height, float length, ::Color color={255, 255, 255, 255}) const
 Draw cube with a region of a texture. More...
 
void DrawCube (::Vector3 position, ::Vector3 dimensions, ::Color color={255, 255, 255, 255}) const
 Draw cube textured, with dimensions. More...
 
void DrawCube (::Vector3 position, float width, float height, float length, ::Color color={255, 255, 255, 255}) const
 Draw cube textured. More...
 
void DrawPoly (::Vector2 center, ::Vector2 *points, ::Vector2 *texcoords, int pointsCount, ::Color tint={255, 255, 255, 255}) const
 Draw a textured polygon. More...
 
void DrawTiled (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, float scale=1, Color tint={255, 255, 255, 255}) const
 Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. More...
 
TextureUnmanaged & GenMipmaps ()
 Generate GPU mipmaps for a texture.
 
inline ::Image GetData () const
 Get pixel data from GPU texture and return an Image.
 
int GetFormat () const
 Retrieves the format value for the object. More...
 
int GetHeight () const
 Retrieves the height value for the object. More...
 
unsigned int GetId () const
 Retrieves the id value for the object. More...
 
int GetMipmaps () const
 Retrieves the mipmaps value for the object. More...
 
inline ::Vector2 GetSize () const
 Retrieve the width and height of the texture.
 
int GetWidth () const
 Retrieves the width value for the object. More...
 
bool IsReady () const
 Determines whether or not the Texture has been loaded and is ready. More...
 
void Load (const ::Image &image)
 Load texture from image data.
 
void Load (const ::Image &image, int layoutType)
 Load cubemap from image, multiple image cubemap layouts supported.
 
void Load (const std::string &fileName)
 Load texture from file into GPU memory (VRAM)
 
 operator Image ()
 Get pixel data from GPU texture and return an Image.
 
TextureUnmanaged & operator= (const ::Texture &texture)
 
TextureUnmanaged & SetFilter (int filterMode)
 Set texture scaling filter mode.
 
void SetFormat (int value)
 Sets the format value for the object. More...
 
void SetHeight (int value)
 Sets the height value for the object. More...
 
void SetId (unsigned int value)
 Sets the id value for the object. More...
 
TextureUnmanaged & SetMaterial (::Material *material, int mapType=MATERIAL_MAP_NORMAL)
 Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
 
TextureUnmanaged & SetMaterial (const ::Material &material, int mapType=MATERIAL_MAP_NORMAL)
 
void SetMipmaps (int value)
 Sets the mipmaps value for the object. More...
 
TextureUnmanaged & SetShaderValue (const ::Shader &shader, int locIndex)
 Set shader uniform value for texture (sampler2d)
 
TextureUnmanaged & SetShapes (const ::Rectangle &source)
 Set texture and rectangle to be used on shapes drawing.
 
void SetWidth (int value)
 Sets the width value for the object. More...
 
TextureUnmanaged & SetWrap (int wrapMode)
 Set texture wrapping mode.
 
void Unload ()
 Unload texture from GPU memory (VRAM)
 
TextureUnmanaged & Update (::Rectangle rec, const void *pixels)
 Update GPU texture rectangle with new data.
 
TextureUnmanaged & Update (const void *pixels)
 Update GPU texture with new data.
 

Additional Inherited Members

- Protected Member Functions inherited from raylib::TextureUnmanaged
void set (const ::Texture &texture)
 

Detailed Description

Texture type.

The texture will be unloaded on object destruction. Use raylib::TextureUnmanaged if you're looking to not unload.

See also
raylib::TextureUnmanaged

Definition at line 14 of file Texture.hpp.

Member Function Documentation

◆ TextureUnmanaged() [1/3]

raylib::TextureUnmanaged::TextureUnmanaged
inline

Creates a texture from the given Image.

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given image.

Definition at line 54 of file TextureUnmanaged.hpp.

◆ TextureUnmanaged() [2/3]

raylib::TextureUnmanaged::TextureUnmanaged
inline

Load cubemap from image, multiple image cubemap layouts supported.

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given cubemap.
See also
LoadTextureCubemap()

Definition at line 65 of file TextureUnmanaged.hpp.

◆ TextureUnmanaged() [3/3]

raylib::TextureUnmanaged::TextureUnmanaged
inline

Load texture from file into GPU memory (VRAM)

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given file.

Definition at line 74 of file TextureUnmanaged.hpp.