Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:07
    BlacksmithSouls starred mosra/magnum
  • 03:08
    glitch978 starred mosra/magnum
  • Oct 05 17:52
    MakkambaevDastan starred mosra/magnum
  • Oct 05 16:36
    mosra milestoned #20
  • Oct 05 16:36
    mosra milestoned #20
  • Oct 05 16:36
    mosra commented #20
  • Oct 05 16:26
    Skylion007 opened #20
  • Oct 05 16:26
    Skylion007 edited #20
  • Oct 05 09:58
    mosra closed #594
  • Oct 05 09:57
    mosra commented #19
  • Oct 05 09:57
    mosra closed #19
  • Oct 05 09:57

    mosra on master

    python: remove extra copy in gl… doc: updated changelog. (compare)

  • Oct 05 09:54
    mosra labeled #19
  • Oct 05 09:54
    mosra commented #594
  • Oct 05 09:53

    mosra on master

    modules: update FindSDL2.cmake … doc: updated credits and change… Doc++ Just fixing minor consis… (compare)

  • Oct 05 09:51
    mosra commented #151
  • Oct 05 09:51
    mosra closed #151
  • Oct 05 09:51

    mosra on master

    Containers: fix BitArray{,View}… Containers: minor. doc: updated credits and change… and 3 more (compare)

  • Oct 05 09:44

    mosra on next

    modules: update FindSDL2.cmake … doc: updated credits and change… Doc++ Just fixing minor consis… (compare)

  • Oct 05 09:38
    mosra labeled #594
Mathew
@lectroMathew
MSVC 2019 detected, automatically enabling MSVC2019_COMPATIBILITY. Note that some features may not be available with this compiler.
pezcode
@pezcode
MSVC works perfectly fine with Magnum, could be some undefined behaviour in your code?
Mathew
@lectroMathew
I wonder...
Jean-Marie Baran
@Jim-Bar
Hi there, beginner question:
I'm using instancing for drawing many objects using a single mesh (with GL::Mesh::addVertexBufferInstanced()). It works, however it still requires looping on all objects for updating the instance data with new transformations (e.g. when the camera moves), which makes it slow. Is there a strategy to update the transformation of all the objects at once? I'm using the PhongGL shader
pezcode
@pezcode
Are you using SceneGraph? Either way, if the camera moves, your object transformations shouldn't have to change
PhongGL has setTransformationMatrix that gets applied after the instanced transformation
Jean-Marie Baran
@Jim-Bar
Yes I do. Indeed, yet the transformations relative to camera change, and it is this one which I put in the instance array. Something like: arrayAppend(_instanceData, InPlaceInit, t, t.normalMatrix(), _color); with t being relative to camera. So when it change, currently I must recompute everything
Okay looking into that :)
pezcode
@pezcode
If you want to update the objects' positions etc. you can update parts of the instance buffer (setSubData), but I don't know if that's really faster in your case than recomputing and sending the entire thing
Time to profile :eyes:
When I did some stuff with instancing I had a drawable that collected all its child nodes as instances and updated the entire array every frame. Didn't see any huge performance impact but I'm only talking 30 objects
Jean-Marie Baran
@Jim-Bar
Thanks for the info, in truth the only thing moving is the camera so it feels like setTransformationMatrix() could really help here. Just the time to comprehend things, I am beginning with rendering
I have ~10K objects
pezcode
@pezcode
Alright, that's a different league :laughing: Makes sense you see an impact there
Jean-Marie Baran
@Jim-Bar
Haha indeed!
Vladimír Vondruš
@mosra
the scene graph is unfortunately not helping here by providing a camera-relative transform, yeah .. if you can do without it and manage your hierarchy directly (or with entt, etc.), then the solution would be to pass scene-root-relative transforms via the instance buffer and camera-to-scene-root separately via setTransformationMatrix()

Is MSVC supported with magnum?

@lectroMathew haha, yes it is, the CMake warning is because certain APIs behave slightly differently than they would with a standard-conforming compiler (usually with less safety checks), however if you code compiles with MinGW in the first place then it should run on MSVC too

one thing that varies a lot between MSVC and GCC is the order in which function arguments are evaluated, and in certain cases that matters (for example when using release() on objects)
Mathew
@lectroMathew
Yeah Im still trying to figure out what causes msvc to not draw anything... Seems very weird tbh
Jean-Marie Baran
@Jim-Bar
@mosra Got it working with arrayAppend(_instanceData, InPlaceInit, _cameraTransformation * t, t.normalMatrix(), _color); on one hand (scene-root-relative transform into the instance buffer), and _shader.setTransformationMatrix(_cameraObject->absoluteTransformation().inverted()); on the other hand. Works like a charm, thanks for the help
Fo Nz
@FoNz99089892_twitter
I discovered a bottleneck in my game. Mouse picking involves glReadPixels, which flushes and waits for all the OpenGL commands. This kills the performance on Android devices (expecially low-end phones). This should be noted in the docs, since the goal of Magnum is to hide OpenGL by providing an abstraction.
Vladimír Vondruš
@mosra
Framebuffer::read() could be a good place where to mention this, right?
i'm not sure what the mouse picking example does exactly, but it should be possible to offset this by reading from the front buffer i think?
then if you're rendering to the back buffer and reading from the front you shouldn't be stalling anything
Vladimír Vondruš
@mosra
blargh, this is not the default framebuffer, of course
so the solution is to double (triple) buffer that yourself, with multiple FBOs
Fo Nz
@FoNz99089892_twitter
As I read from the OpenGL docs, both buffer swap and FBO binding may cause syncing to the last command for OpenGL. So I think framebuffer should be read right after this happens in any application. So it's outside of "Magnum scope", but I think it's still worth mentioning...
Vladimír Vondruš
@mosra
syncing or flushing?
that a FBO binding would cause the pipeline to sync sounds strange
buffer swap of the default framebuffer causes a glFinish() to be called, yes (because you gotta wait for it to have it presented), but rebinding another FBO shouldn't cause a pipeline stall i think
another option instead of double-buffering is to delay the picking to the beginning of the next frame, before anything gets submitted to GL, but that might complicate the logic a lot
Fo Nz
@FoNz99089892_twitter

that a FBO binding would cause the pipeline to sync sounds strange

I have read that i(t may cause) in "Implicit synchronization" paragraph here (look at the last sentence):
https://www.khronos.org/opengl/wiki/Synchronization

another option instead of double-buffering is to delay the picking to the beginning of the next frame

Yes, that's what I done, and right after the framebuffer is bound but not cleared yet.

Azvf
@Azvf
I'm trying to scale a object derived from Object3D and Scene3D, But why doesn't the scale code work after the setTransformation() function?
    _outlineDrawable = SceneGraph::DrawableGroup3D{};
    _outliner.reset(new Outliner(&mesh, *_outlineDrawable, _scene));
    _outliner->scale(Magnum::Vector3{ 1.1f });
    auto mat = objects._attachmentObjects[id]->transformation();
    _outliner->setTransformation(mat);
Guillaume Jacquemin
@williamjcm
setTransformation overrides the existing transformation.
I think you want transform() instead.
Azvf
@Azvf
It worked, Thank you for the help!
Guillaume Jacquemin
@williamjcm
You're welcome! :thumbsup:
Azvf
@Azvf
I'm trying to import a lib in js within the scope of EM_ASM or EM_JS, but from the doc it seems it'll encapsulate them into a function anyway. Then how can I get around with it?
hsdk123
@hsdk123

Hey all > iOS

I see that my application doesn't seem to fill the screen - the sdl viewportEvent gives me

window size: (480, 320). dpi scaling: (1, 1). framebuffer size: (960, 640)

when it's clear though that the phone screen is much wider.

image0.png
Would anyone know what might be causing this?
hsdk123
@hsdk123
Seems it had to with adding the launch images or a launch storyboard
Vladimír Vondruš
@mosra
is it possible sdl has some weird / outdated default sizes? iirc (in 2016) i always had to force the size manually somehow to make it fill the screen and be "Retina"
Fo Nz
@FoNz99089892_twitter
@mosra How do I preserve the OpenGL ES Context on Android? Normally, I would destroy the window, but not the context. Then, on resume, I would create a new window and reattach the old context. This resembles the behaviour of setPreserveEGLContextOnPause. Can I do this without some tweaking on Magnum's source?
I don't care if app gets destroyed by the OS while in background. This would happen with any app, anyway.
Vladimír Vondruš
@mosra
i have no idea, honestly
do you use the AndroidApplication or something custom?
as long as you can retrieve and save the context handle (and the corresponding magnum GL context) then it should work