mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-28 17:59:17 -05:00
Reviewed GetTextureData()
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user