aboutsummaryrefslogtreecommitdiff
path: root/src/textures.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2015-11-04 18:33:46 +0100
committerRay <raysan5@gmail.com>2015-11-04 18:33:46 +0100
commit76024b5036f060a19a1a2eea49c401d6db81cda8 (patch)
tree32b2a85a37dbc12d303467d7fb6669ee11b6f47f /src/textures.c
parent002dacef4091de16731961c9b85363097d14106b (diff)
downloadraylib-76024b5036f060a19a1a2eea49c401d6db81cda8.tar.gz
raylib-76024b5036f060a19a1a2eea49c401d6db81cda8.zip
Added some texture functionality (view details)
LoadTextureEx() - Simplified parameters UpdateTexture() - Added, allows updating GPU texture data
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/textures.c b/src/textures.c
index 007547ca..076ed935 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -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)
{