aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2019-01-06 15:49:29 +0100
committerraysan5 <raysan5@gmail.com>2019-01-06 15:49:29 +0100
commitf4fe7f4d4c6d25e4bcc1ea4b48af07ef49b82720 (patch)
tree235fd40facc47305fa03d3fc0471ba2b3c40fe83 /src
parent5c614f69755623e346105d17c71697005bd2900c (diff)
downloadraylib-f4fe7f4d4c6d25e4bcc1ea4b48af07ef49b82720.tar.gz
raylib-f4fe7f4d4c6d25e4bcc1ea4b48af07ef49b82720.zip
Review BRDF texture generation
Actually, that function should be redesigned...
Diffstat (limited to 'src')
-rw-r--r--src/rlgl.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 2b575614..8c7526fb 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -3221,6 +3221,7 @@ Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
// Generate BRDF texture using cubemap data
// NOTE: OpenGL ES 2.0 does not support GL_RGB16F texture format, neither GL_DEPTH_COMPONENT24
+// TODO: Review implementation: https://github.com/HectorMF/BRDFGenerator
Texture2D GenTextureBRDF(Shader shader, int size)
{
Texture2D brdf = { 0 };
@@ -3229,9 +3230,9 @@ Texture2D GenTextureBRDF(Shader shader, int size)
glGenTextures(1, &brdf.id);
glBindTexture(GL_TEXTURE_2D, brdf.id);
#if defined(GRAPHICS_API_OPENGL_33)
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, size, size, 0, GL_RG, GL_FLOAT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, size, size, 0, GL_RGB, GL_FLOAT, NULL);
#elif defined(GRAPHICS_API_OPENGL_ES2)
- if (texFloatSupported) glTexImage2D(GL_TEXTURE_2D, 0, GL_RG, size, size, 0, GL_RG, GL_FLOAT, NULL);
+ if (texFloatSupported) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size, size, 0, GL_RGB, GL_FLOAT, NULL);
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -3269,6 +3270,8 @@ Texture2D GenTextureBRDF(Shader shader, int size)
brdf.width = size;
brdf.height = size;
+ brdf.mipmaps = 1;
+ brdf.format = UNCOMPRESSED_R32G32B32;
#endif
return brdf;
}