I'm still very new to Raylib, but as far as I can tell, you can to get the image from the texture, and then you can get the pixel data from the image, manipulate it, and upload the data to the texture again. If you're making frequent changes it may be worthwhile to keep the image at hand.
Alternatively, you can also load from a file into an image first, instead of a texture, and then create the texture from that image, and keep the image around if you need.
Relevant functions:
| Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
And just by the way:
| Image GetScreenData(void); // Get pixel data from screen buffer and return an Image (screenshot)
|