diff options
| author | Ray <raysan5@gmail.com> | 2017-04-04 23:44:36 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2017-04-04 23:44:36 +0200 |
| commit | 99affa0cafb466bc960137a4a67128c1c4fd2e17 (patch) | |
| tree | 6b78df87c865803b98b9f4bc1a186fe2093821f1 | |
| parent | 1f56e8e5d0000e1c46483530331887dbd0f8ce75 (diff) | |
| download | raylib-99affa0cafb466bc960137a4a67128c1c4fd2e17.tar.gz raylib-99affa0cafb466bc960137a4a67128c1c4fd2e17.zip | |
Corrected issue when retrieving texture from GPU
| -rw-r--r-- | src/textures.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/textures.c b/src/textures.c index fff0e4e9..8e3a1ee1 100644 --- a/src/textures.c +++ b/src/textures.c @@ -516,12 +516,14 @@ Image GetTextureData(Texture2D texture) image.width = texture.width; image.height = texture.height; image.mipmaps = 1; -#if defined(GRAPHICS_API_OPENGL_ES2) - // NOTE: Data retrieved on OpenGL ES 2.0 comes as RGB (from framebuffer) - image.format = UNCOMPRESSED_R8G8B8A8; -#else - image.format = texture.format; -#endif + + if (rlGetVersion() == OPENGL_ES_20) + { + // NOTE: Data retrieved on OpenGL ES 2.0 comes as RGBA (from framebuffer) + image.format = UNCOMPRESSED_R8G8B8A8; + } + else image.format = texture.format; + TraceLog(INFO, "Texture pixel data obtained successfully"); } else TraceLog(WARNING, "Texture pixel data could not be obtained"); |
