Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:20
    ProDCG starred mosra/magnum-examples
  • 19:13

    mosra on next

    Containers: don't use the depre… doc: change the way CORRADE_BUI… Containers: add a forward decla… and 7 more (compare)

  • Nov 29 23:17
    mosra closed #20
  • Nov 29 23:17
    mosra commented #20
  • Nov 29 23:17

    mosra on master

    python: more missing moves, unn… doc: updated changelog. (compare)

  • Nov 29 23:10
    mosra labeled #20
  • Nov 29 23:09

    mosra on next

    python: more missing moves, unn… doc: updated changelog. (compare)

  • Nov 29 22:41
    Skylion007 commented #20
  • Nov 29 22:41
    Skylion007 commented #20
  • Nov 29 18:43
    Reticulatas closed #609
  • Nov 29 18:43
    Reticulatas commented #609
  • Nov 29 09:06
    MachinaXi starred mosra/magnum
  • Nov 29 08:19
    mosra commented #609
  • Nov 29 07:33
    Reticulatas commented #609
  • Nov 29 07:29
    NeoCC91 starred mosra/magnum
  • Nov 29 07:28
    NeoCC91 starred mosra/corrade
  • Nov 29 06:21
    ahribellah starred mosra/magnum
  • Nov 28 23:50
    Reticulatas edited #609
  • Nov 28 23:45
    Reticulatas opened #609
  • Nov 28 12:37
    hxf0223 starred mosra/magnum
Vladimír Vondruš
@mosra

just to clarify:

  • either pass Version::GLES300 / Version::GL330 to the constructor, which will add the #version directive automatically (recommended)
  • or pass Version::None and then add a #version directive directly in the source

... but if i understand what you're saying, you somehow get a #line line followed by a #version line? :O

Mathew
@lectroMathew
Hey, I get an exception when creating AbstractShaderProgram at the _id != Implementation::State::DisengagedBinding assert, I assume that's because GL is not initialized at the moment of creation or something? Can I somehow force initialization before any shader creation?
Vladimír Vondruš
@mosra
the shader being the application class member, i suppose, and you delay GL context creation, right?
it's not possible to force GL initialization before creating a shader, but you can delay creating a shader after GL gets initialized
commented example is here: https://doc.magnum.graphics/magnum/opengl-wrapping.html#opengl-wrapping-instances-nocreate i suppose you have it organized a bit differently, but basically start with a NoCreated instance and then when you have GL context ready, move over a properly created instance
Mathew
@lectroMathew
perfect, thanks
Fo Nz
@FoNz99089892_twitter

... but if i understand what you're saying, you somehow get a #line line followed by a #version line? :O

Yes, I was getting that line. Look at the source I linked to you. Anyway, I managed to edit the Magnum source, recompile and make that line go away.

Mathew
@lectroMathew
In my CMake I have BUILD_PLUGINS_STATIC set to ON, yet I still get these two errors every time: PluginManager::Manager::Manager(): none of the plugin search paths in {magnum-d/importers} exists and pluginDirectory was not set, skipping plugin discovery and PluginManager::Manager::load(): plugin AnySceneImporter is not static and was not found in when building with MinGW, however when building with MSVC it seems to correctly find all plugins, what might cause such behavior?
Fo Nz
@FoNz99089892_twitter
MSVC fixes the lib import order for you. Other compiler don't. Check on libs order.
Mathew
@lectroMathew
CMAKE_RUNTIME_OUTPUT_DIRECTORY was the issue, is has already been reported here mosra/magnum#486
马迪
@linuxaged
@mosra what's the status of vulkan support in magnum now? and is there any plan for WebGPU which will be shipped in Chrome 98
Vladimír Vondruš
@mosra

I managed to edit the Magnum source

@FoNz99089892_twitter i'm saying, this exact scenario should work without having to patch anything, i even have a test case for exactly that: https://github.com/mosra/magnum/blob/dbec10dbee8cc3c2b560c6e7de9166c2b6d2f002/src/Magnum/GL/Test/ShaderGLTest.cpp#L195-L225

Look at the source I linked

the question is instead, how does your source look? because this is definitely possible and it only looks like you're doing something differently that results in a #line getting inserted before your #version;) can you show me how the shader gets constructed and populated?

@lectroMathew argh, looks like i should finally step up and resolve all the pending issues

@linuxaged Vulkan support (the low-level APIs) are mostly done right now, what's missing is mostly a bunch of convenience APIs for shaders

right now i'm focusing on vulkan- (batch-) friendly scene import, because without that using Vulkan makes little sense, WebGPU is planned for the next months if I get funding for it

Mathew
@lectroMathew
How do I bundle libPNG so that PngImporter would be able to successfully find it? Right now I have it in my lib/ folder along with
list(APPEND CMAKE_PREFIX_PATH lib/lpng1637) add_dependencies(MyApp MagnumPlugins::PngImporter)
Cmake instructions, like documentation states. Yet it seems to struggle finding the lib anyway Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR) _FPHSA_FAILURE_MESSAGE
Vladimír Vondruš
@mosra
wait, there's something i missed ... you're enabling BUILD_PLUGINS_STATIC but still link to a dynamic one?
Mathew
@lectroMathew
nono I build them dynamically now
Vladimír Vondruš
@mosra
ah okay, that explains :)
if you don't want to bother with libpng (which, honestly, is a pain to set up unless you can just use a system package on linux/mac), go with StbImageImporter instead, that one is dependency-less
and the speed (for PNGs at least) is comparable
Mathew
@lectroMathew
Oh yeah that sounds great, thanks for suggestion
Fo Nz
@FoNz99089892_twitter

can you show me how the shader gets constructed and populated?

GL::Shader vert{ GL::Version::GLES300, GL::Shader::Type::Vertex };
vert.addFile("shaders/screen_quad.vert");
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({ vert }));

In realty, I have both vert and frag, but I'm showing you only vert. Anyway, I managed to fix this problem, which I think it was due to some bad action I was doing. This is surely not Magnum's fault, I am sure. Also, this error happened only on Samsung devices... don't worry.

Vladimír Vondruš
@mosra
and the screen_quad.vert has a #version line on its own or not?
that it makes only a Samsung device fail is what worries me about this problem :)
Fo Nz
@FoNz99089892_twitter

and the screen_quad.vert has a #version line on its own or not?

Excuse me, but I now progressed with my game development, so I don't remember exactly. I can't give you exactly details, but I remember trying both with #version 300 es and without. But I repeat: I think it was my fault for doing something bad. I don't remember now. Anyway thanks!

Mathew
@lectroMathew
Is MSVC supported with magnum? I get perfect compilation with no errors, but nothing gets drawn except for the framebuffer clear color. The same exact code draws when compiled with MinGW however
I saw that Corrade spits out MSVC2019_COMPATIBILITY related warning, might this be the reason why?
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?