Skip to content

Commit

Permalink
Fix tests/float_tex.cpp to use unsized texture internal format GL_RGB…
Browse files Browse the repository at this point in the history
…A instead of sized texture internal format GL_RGBA32F for floating point texture, since GLES2/WebGL1 does not support the sized variants.
  • Loading branch information
juj committed Dec 11, 2014
1 parent 8c863fe commit 5c88830
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/float_tex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ static void updateFloatTexture() {
++count;
}
glBindTexture(GL_TEXTURE_2D, nodeTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, nbNodes, 1, 0, GL_RGBA, GL_FLOAT, data);
#ifdef __EMSCRIPTEN__ // In GLES2 and WebGL1, we must use unsized texture internal formats.
const GLenum internalFormat = GL_RGBA;
#else
// In desktop GL, we can also use sized internal formats.
const GLenum internalFormat = GL_RGBA32F;
#endif
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, nbNodes, 1, 0, GL_RGBA, GL_FLOAT, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, NULL);
Expand Down

0 comments on commit 5c88830

Please sign in to comment.