Makes managing textures samplers and off-screen rendering simpler.
More...
#include <vulkan/vulkan.h>
#include "VK2D/Structs.h"
Go to the source code of this file.
Makes managing textures samplers and off-screen rendering simpler.
- Author
- Paolo Mazzon
◆ vk2dTextureCreate()
VK2DTexture vk2dTextureCreate |
( |
float |
w, |
|
|
float |
h |
|
) |
| |
Creates a texture meant as a drawing target - see vk2dRendererSetTarget
- Parameters
-
w | Width of the texture |
h | Height of the texture |
- Returns
- Returns a new texture or NULL if it failed
- Warning
- If you do not completely fill the created texture (ie, with something like
vk2dRendererEmpty
or vk2dRendererClear
) before you draw this texture it will cause crashes on certain hardware.
◆ vk2dTextureFree()
void vk2dTextureFree |
( |
VK2DTexture |
tex | ) |
|
Frees a texture from memory.
- Parameters
-
◆ vk2dTextureFrom()
VK2DTexture vk2dTextureFrom |
( |
void * |
data, |
|
|
int |
size |
|
) |
| |
Same as vk2dTextureLoad but it uses a byte buffer instead of pulling from a file.
- Parameters
-
data | Pointer to the image data, either png, bmp, jpg, or tiff |
size | Size in bytes of the data buffer |
- Returns
- Returns a new texture or NULL if it failed
- Warning
- Textures created with this function are NOT valid render targets
◆ vk2dTextureGetID()
uint32_t vk2dTextureGetID |
( |
VK2DTexture |
tex | ) |
|
Returns a unique ID for this texture.
- Parameters
-
tex | Texture to get the id of |
- Returns
- Returns a unique uint32_t ID for this texture, used for sprite batching/user shaders
This function is thread-safe.
◆ vk2dTextureGetImage()
VK2DImage vk2dTextureGetImage |
( |
VK2DTexture |
tex | ) |
|
Returns a texture's internal image.
- Parameters
-
- Returns
- Returns the texture's image
◆ vk2dTextureHeight()
float vk2dTextureHeight |
( |
VK2DTexture |
tex | ) |
|
Gets the height in pixels of a texture.
- Parameters
-
tex | Texture to get the height from |
- Returns
- Returns the height in pixels
◆ vk2dTextureIsTarget()
bool vk2dTextureIsTarget |
( |
VK2DTexture |
tex | ) |
|
Checks if a texture was created as a target or not.
- Parameters
-
- Returns
- Returns true if its a valid target, false otherwise
◆ vk2dTextureLoad()
VK2DTexture vk2dTextureLoad |
( |
const char * |
filename | ) |
|
Loads a texture from a file (png, bmp, jpg, tiff)
- Parameters
-
- Returns
- Returns a new texture or NULL if it failed
- Warning
- Textures created with this function are NOT valid render targets
◆ vk2dTextureLoadFromImage()
VK2DTexture vk2dTextureLoadFromImage |
( |
VK2DImage |
image | ) |
|
Creates a texture from an image.
- Parameters
-
- Returns
- Returns a new texture or NULL if it failed
- Warning
- Textures created with this function are NOT valid render targets
◆ vk2dTextureWidth()
float vk2dTextureWidth |
( |
VK2DTexture |
tex | ) |
|
Gets the width in pixels of a texture.
- Parameters
-
tex | Texture to get the width from |
- Returns
- Returns the width in pixels