{"action":"created","issue":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/895","repository_url":"https://api.github.com/repos/bkaradzic/bgfx","labels_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/895/labels{/name}","comments_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/895/comments","events_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/895/events","html_url":"https://github.com/bkaradzic/bgfx/issues/895","id":174000716,"number":895,"title":"WebGL and RGBA32F Texture format ","user":{"login":"hcomere","id":15142649,"avatar_url":"https://avatars.githubusercontent.com/u/15142649?v=3","gravatar_id":"","url":"https://api.github.com/users/hcomere","html_url":"https://github.com/hcomere","followers_url":"https://api.github.com/users/hcomere/followers","following_url":"https://api.github.com/users/hcomere/following{/other_user}","gists_url":"https://api.github.com/users/hcomere/gists{/gist_id}","starred_url":"https://api.github.com/users/hcomere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcomere/subscriptions","organizations_url":"https://api.github.com/users/hcomere/orgs","repos_url":"https://api.github.com/users/hcomere/repos","events_url":"https://api.github.com/users/hcomere/events{/privacy}","received_events_url":"https://api.github.com/users/hcomere/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-30T12:00:42Z","updated_at":"2016-08-30T16:27:12Z","closed_at":null,"body":"Hi,\r\n\r\nI had already created an issue on this subject ( [https://github.com/bkaradzic/bgfx/issues/592] ) which becomes old and was left unresolved in depth.\r\nAfter some more investigations, i am now convinced that there is an issue in bgfx.\r\n\r\nThe first thing is that creating a float texture in raw JS/WebGL as below works on both last Chrome and FireFox which both have OES_texture_float extensions.\r\n\r\n```\r\n        var data = new Float32Array([\r\n            0.5, 0., 0., 1.\r\n            , 0., 1., 0., 1.\r\n            , 0., 0., 1., 1.\r\n            , 1., 1., 0., 1. \r\n        ]);\r\n        \r\n        gl.bindTexture(gl.TEXTURE_2D, neheTexture);\r\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.FLOAT, data);\r\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n        gl.bindTexture(gl.TEXTURE_2D, null);\r\n```\r\n\r\nSecond point, according to [Emscripten documentation](https://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html), when using EGL API to create GL context, all available and non-performance impacting extension are enabled automatically.\r\n\r\nThis point out that we should be able to create float texture using emscripten.\r\n\r\nThird point, i have checked [the test done by bgfx](https://github.com/bkaradzic/bgfx/blob/master/src/renderer_gl.cpp#L1132) to determine whether the GL_RGBA32F is supported, which seems to be incorrect.\r\n\r\ns_textureFormat[TextureFormat::RGBA32F] contains :\r\n\r\n- internal format : 0x8814, which is not present neither in OpenGLES 2.0 nor in WebGL 1.0 specs. This value is defined by bgfx [here](https://github.com/bkaradzic/bgfx/blob/master/src/renderer_gl.h#L278).\r\n\r\n- format : 0x1908 corresponding to GL_RGBA, OK\r\n- type : 0x1406 corresponding to GL_FLOAT OK\r\n\r\nThe expected internal format is also GL_RGBA to check correctly GL_RGBA32F texture format support.\r\n\r\nTherefore bgfx::Caps says that GL_RGBA32F is not supported, only emulated.\r\nThis constrat with GL_RGBA16F which is flagged as supported, we have format == internal format in texture format support test.\r\n\r\nAny hint ?\r\n\r\n\r\nRegards,\r\nHarold"},"comment":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/comments/243497516","html_url":"https://github.com/bkaradzic/bgfx/issues/895#issuecomment-243497516","issue_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/895","id":243497516,"user":{"login":"bkaradzic","id":814772,"avatar_url":"https://avatars.githubusercontent.com/u/814772?v=3","gravatar_id":"","url":"https://api.github.com/users/bkaradzic","html_url":"https://github.com/bkaradzic","followers_url":"https://api.github.com/users/bkaradzic/followers","following_url":"https://api.github.com/users/bkaradzic/following{/other_user}","gists_url":"https://api.github.com/users/bkaradzic/gists{/gist_id}","starred_url":"https://api.github.com/users/bkaradzic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkaradzic/subscriptions","organizations_url":"https://api.github.com/users/bkaradzic/orgs","repos_url":"https://api.github.com/users/bkaradzic/repos","events_url":"https://api.github.com/users/bkaradzic/events{/privacy}","received_events_url":"https://api.github.com/users/bkaradzic/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T16:27:11Z","updated_at":"2016-08-30T16:27:11Z","body":"> What is the meaning of emulated texture format ?\r\n\r\nIt means it will be converted to some other supported format in runtime.\r\n\r\n> internal format : 0x8814, which is not present neither in OpenGLES 2.0 nor in WebGL 1.0 specs. \r\n\r\nCan you add the same line:\r\nhttps://github.com/bkaradzic/bgfx/blob/master/src/renderer_gl.cpp#L1624\r\nfor RGBA32F next to it?"}}
{"actor":{"display_login":"bkaradzic"}}