Git Product home page Git Product logo

Comments (6)

mosra avatar mosra commented on May 23, 2024

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.

wbpaley avatar wbpaley commented on May 23, 2024

from magnum-examples.

mosra avatar mosra commented on May 23, 2024

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.

mosra avatar mosra commented on May 23, 2024

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.

mosra avatar mosra commented on May 23, 2024

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 colors
  • RGBA_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.

mosra avatar mosra commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.