Comments (6)
Ahh, I see. An unfortunate limitation where Firefox doesn't allow a read format any other than GL_RGBA + GL_UNSIGNED_BYTE. I already worked around this for the Mouse Interaction example (that one behaves properly for you, right?), so I will just need to put the same workaround here.
Thanks a lot for the report! 👍
from magnum-examples.
from magnum-examples.
Well, I thought the fix would be simple and so I delayed the fix until now. It turns out to be harder than I thought, hitting one weirdness after another. Investigation so far:
- Applying the same hack as in Mouse Interaction (RGBA + UNSIGNED_BYTE) seemingly works, but the readback returns values from the color buffer, not from the object ID buffer, like if
glReadBuffer()
wouldn't work at all (the same works correctly in Chromium-based browsers). - The object ID buffer is R8UI, but Firefox complains when reading it as R8UI. IMPLEMENTATION_COLOR_READ_FORMAT + TYPE on Firefox returns RGBA_INTEGER + UNSIGNED_INT (reading from R8UI works correctly on Chromium-based browsers).
- Reading as RGBA_INTEGER + UNSIGNED_INT always returns a value of
46460
, no matter where I click; changing the object ID buffer format to RGBA32UI (to match) doesn't help (again, this all works correctly on Chromium-based browsers).
Because it's unlikely I will find a magic solution to this in time for this release, I'm postponing to later.
from magnum-examples.
The PhongGLTest
/ FlatGLTest
Magnum tests now integrate Object ID rendering as well and should be a much easier target to investigate Firefox issues.
from magnum-examples.
The example now uses a R32UI
format for Object ID, so this could get revisited.
While investigating one vaguely related issue (trying to read depth for the mouse interaction example), I saw that the GLES3 specification (4.3.1, page 186) says that the only allowed glReadPixels
format + type combinations are:
RGBA
+UNSIGNED_BYTE
for normalized colorsRGBA_INTEGER
+INT
for signed integer formats- and
RGBA_INTEGER
+UNSIGNED_INT
for unsigned integer formats
Not sure how this interacts with the fact that the Object ID buffer is just a single channel (browsers usually complain that the read type has to match exactly).
from magnum-examples.
This is finally fixed as of 52a5fae. While working on an unrelated issue with GL::Mesh
tests on Firefox I tried this example again and the above-mentioned issue is no longer present:
Reading as RGBA_INTEGER + UNSIGNED_INT always returns a value of
46460
And Firefox now also prints understandable warnings when using anything else than full RGBA and a 32-bit type for buffer reading. Not sure at which point during the last three years Firefox fixed this, but what matters is that it indeed got fixed! 🎉
from magnum-examples.
Related Issues (20)
- Unable to build ImGui example using Vcpkg out of the box HOT 6
- Dragging and Dropping Example?
- WebXR Fails to Load HOT 6
- Audio Example not working HOT 2
- Any gizmos Demo?
- ViewerExample: Generate mesh normals logic is backwards HOT 1
- Text example doesn't render any text on iOS Safari HOT 5
- Undefined variabls HOT 3
- ImGui Rendering State Features HOT 3
- Fix HDPI problem for WebGL examples HOT 1
- Creating my own glb HOT 2
- MeshData.h include no longer valid? HOT 4
- [arch] Dart example configuration fail HOT 2
- EmscriptenApplication.js:35:2:WebXR unsupported in this browser HOT 4
- <box2d/box2d.h> case-sensitive issue HOT 2
- _degf Error HOT 1
- Viewer example closes at startup... HOT 2
- Trouble loading plugins in Viewer demo HOT 5
- Linker errors building Bullet and ImGui examples HOT 5
- Clearly document the implications of deferred GL context creation HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magnum-examples.