mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-12 14:28:15 +00:00
Added some texture functionality (view details)
LoadTextureEx() - Simplified parameters UpdateTexture() - Added, allows updating GPU texture data
This commit is contained in:
@@ -338,16 +338,17 @@ Texture2D LoadTexture(const char *fileName)
|
||||
return texture;
|
||||
}
|
||||
|
||||
Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount)
|
||||
// Load a texture from raw data into GPU memory
|
||||
Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat)
|
||||
{
|
||||
Texture2D texture;
|
||||
|
||||
texture.width = width;
|
||||
texture.height = height;
|
||||
texture.mipmaps = mipmapCount;
|
||||
texture.mipmaps = 1;
|
||||
texture.format = textureFormat;
|
||||
|
||||
texture.id = rlglLoadTexture(data, width, height, textureFormat, mipmapCount);
|
||||
texture.id = rlglLoadTexture(data, width, height, textureFormat, 1);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -1172,6 +1173,13 @@ void GenTextureMipmaps(Texture2D texture)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Update GPU texture with new data
|
||||
// NOTE: pixels data must match texture.format
|
||||
void UpdateTexture(Texture2D texture, void *pixels)
|
||||
{
|
||||
rlglUpdateTexture(texture.id, texture.width, texture.height, texture.format, pixels);
|
||||
}
|
||||
|
||||
// Draw a Texture2D
|
||||
void DrawTexture(Texture2D texture, int posX, int posY, Color tint)
|
||||
{
|
||||
|
Reference in New Issue
Block a user