Reviewed GetTextureData()
This commit is contained in:
parent
037898be56
commit
6da175fccb
1 changed files with 16 additions and 8 deletions
|
@ -490,20 +490,28 @@ Color *GetImageData(Image image)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get pixel data from GPU texture and return an Image
|
// Get pixel data from GPU texture and return an Image
|
||||||
|
// NOTE: Compressed texture formats not supported
|
||||||
Image GetTextureData(Texture2D texture)
|
Image GetTextureData(Texture2D texture)
|
||||||
{
|
{
|
||||||
Image image;
|
Image image;
|
||||||
|
image.data = NULL;
|
||||||
|
|
||||||
image.data = rlglReadTexturePixels(texture.id, texture.format);
|
if (texture.format < 8)
|
||||||
|
|
||||||
if (image.data != NULL)
|
|
||||||
{
|
{
|
||||||
image.width = texture.width;
|
image.data = rlglReadTexturePixels(texture.id, texture.format);
|
||||||
image.height = texture.height;
|
|
||||||
image.format = texture.format;
|
if (image.data != NULL)
|
||||||
image.mipmaps = 1;
|
{
|
||||||
|
image.width = texture.width;
|
||||||
|
image.height = texture.height;
|
||||||
|
image.format = texture.format;
|
||||||
|
image.mipmaps = 1;
|
||||||
|
|
||||||
|
TraceLog(INFO, "Texture pixel data obtained successfully");
|
||||||
|
}
|
||||||
|
else TraceLog(WARNING, "Texture pixel data could not be obtained");
|
||||||
}
|
}
|
||||||
else TraceLog(WARNING, "Texture pixel data could not be obtained");
|
else TraceLog(WARNING, "Compressed texture data could not be obtained");
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue