Closed hcomere closed 8 years ago
Perhaps chrome on your machine fails to use that extension (blacklisting maybe)? Might be useful to find some online demo of that feature and see if it works for you.
Hello,
Sadly, i tested my code on 7 machines with different hardware and this happened 7 times.
A webgl demo using float32 textures is working but the correspondant webgl call is :
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, data);
Note the internal format gl.RGBA without precision. Where can i see how emscripten translate opengl es glTexImage2D calls to webgl texImage2D calls ?
Thanks,
Regards, Harold
In a debug or profiling build you can just look in the emitted code for function _glTextImage2D. Or look in src/library_gl.js
In GLES2 code, the texture format enum GL_RGBA32F
is incorrect and not supported. This comes from GLES2 not having the sized internal formats, but these came in later. The correct form as you pointed out in a later comment is to use the unsized internal format GL_RGBA
. This would be the same in native GLES2 code (native implementations that do support GL_RGBA32F
either have some other extension that enables it, or do so unofficially).
Therefore the call you want to make is
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, data);
GLES3 brings support to sized internal formats, so GL_RGBA32F
should work if you create a GLES3/WebGL2 context.
Does this match what you are seeing? If so, sounds like we can close this issue?
Hello,
I understand that sized internal formats are supported only since GLES3/WebGL2. But it remains some questions about compiling GLES2 code with emscripten :
1) Why does texImage2d with sized internal format work on FireFox ? I have saw that FireFox allows an experimental WebGL2 context, does emscripten create it if available or does emscripten follows the simple pattern "OpenGLES2 => WebGL1, OpenGLES3 => WebGL2" ?
2) Why does RGBA16F internal format works with Chrome where the RGBA32F does not ? Is there an existing chrome WebGL1 extension allowing it ?
I feel that it is mostly a question of extensions.
Regards, Harold
1) I can't remember why GL_RGBA32F works on Firefox in WebGL1. It could be the case that this "leaks" through by accident, or that there is some extension I can't recall right now. It is best to avoid using it though, unless you can find a piece of spec wording that lets you.
2) RGBA16F sized internal format is exposed by this extension: https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_half_float/ , and both FF and Chrome should support it when that extension is activated.
2015-12-18 13:27 GMT+02:00 Harold Comere notifications@github.com:
Hello,
I understand that sized internal formats are supported only since GLES3/WebGL2. But it remains some questions about compiling GLES2 code with emscripten :
1) Why does texImage2d with sized internal format work on FireFox ? I have saw that FireFox allows an experimental WebGL2 context, does emscripten create it if available or does emscripten follows the simple pattern "OpenGLES2 => WebGL1, OpenGLES3 => WebGL2" ?
2) Why does RGBA16F internal format works with Chrome where the RGBA32F does not ? Is there an existing chrome WebGL1 extension allowing it ?
I feel that it is mostly a question of extensions.
Regards, Harold
— Reply to this email directly or view it on GitHub https://github.com/kripken/emscripten/issues/3946#issuecomment-165752691 .
Hi,
Sorry for the response delay but i was not able to work more on this issue until now.
With WebGL1 it is mandatory to have format == internal format, without size. So, as it was pointed out, right call for :
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_HALF_FLOAT, data);
And this works as expected on both Chrome and FireFox :)
Therefore the renderer is responsible to convert format / internal format couple according to target platform.
Finally, that is not an emscripten issue.
Thanks for your help !
Regards, Harold
Hello,
The following call to glTexImage2D returns GL_INVALID_ENUM on Chrome 46 but works on Firefox 42.
The following link returns that Chrome supports OES_texture_float extension : https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/oes-texture-float.html?webglVersion=1
Any hint ?
Regards, Harold