Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:01

    mosra on next

    Shaders: add MeshVisualizer TBN… Shaders: minor, but confusing. … Shaders: reduce redundant expre… and 2 more (compare)

  • 17:40

    mosra on next

    Shaders: add MeshVisualizer TBN… Shaders: minor, but confusing. … Shaders: reduce redundant expre… and 2 more (compare)

  • 17:21

    mosra on next

    Shaders: add MeshVisualizer TBN… Shaders: minor, but confusing. … Shaders: reduce redundant expre… and 2 more (compare)

  • 15:18
    codecov[bot] commented #547
  • 14:25
    jnewman314 starred mosra/magnum
  • 12:43

    mosra on master

    Shaders: drop a bunch of redund… Shaders: clean up GL version re… Shaders: minor test cleanup. and 6 more (compare)

  • 12:19
    codecov[bot] commented #547
  • 12:19
    pezcode synchronize #547
  • Jan 23 21:56
    jvannugteren commented #94
  • Jan 23 21:15

    mosra on next

    Shaders: drop a bunch of redund… Shaders: clean up GL version re… Shaders: minor test cleanup. and 6 more (compare)

  • Jan 23 12:08
    jvannugteren commented #94
  • Jan 22 21:05

    mosra on next

    Shaders: clean up GL version re… Shaders: support object ID text… Shaders: support object ID text… (compare)

  • Jan 22 19:44

    mosra on next

    Shaders: drop a bunch of redund… Shaders: clean up GL version re… Shaders: support object ID text… and 1 more (compare)

  • Jan 22 19:33
    halitsever starred mosra/magnum
  • Jan 22 07:36
    alexpineda starred mosra/magnum
  • Jan 22 00:37
    xansrnitu starred mosra/magnum
  • Jan 21 21:43

    mosra on next

    [wip] Shaders: support object I… (compare)

  • Jan 21 21:30

    mosra on master

    MeshOptimizerSceneConverter: mi… MeshOptimizerSceneConverter: ad… (compare)

  • Jan 21 21:29

    mosra on master

    package/ci: ah yes, Xcode image… doc: yep, this order is wrong. … MeshTools: don't put const on a… and 44 more (compare)

hsdk123
@hsdk123

https://gist.github.com/hsdk123/7f66ecf92d8f51ffaa3e4ac241d4682f

Here's a copy of my code if it shows anything

Vladimír Vondruš
@mosra
are you setting Renderer::setBlendFunction somewhere? i can't see that
what is documented there is one way, you might need some other way depending on whether the images have premultiplied alpha or not, and the tool could help figure out the parameters
hsdk123
@hsdk123
Yeah, it's in
void lvn::CRenderMgr::ApplyBlendMode(const BlendMode& new_mode)
{
    using namespace Magnum;
    static bool init = false;
    static BlendMode cache = BlendMode::BlendAlpha;

    if (!init) {
        GL::Renderer::enable(GL::Renderer::Feature::Blending);
    }
    if (!init || cache != new_mode) {
        GL::Renderer::setBlendFunction(
            static_cast<GL::Renderer::BlendFunction>(new_mode.rgbSrcFactor),
            static_cast<GL::Renderer::BlendFunction>(new_mode.rgbDstFactor),
            static_cast<GL::Renderer::BlendFunction>(new_mode.alphaSrcFactor),
            static_cast<GL::Renderer::BlendFunction>(new_mode.alphaDstFactor)
        );
        GL::Renderer::setBlendEquation(
            static_cast<GL::Renderer::BlendEquation>(new_mode.rgbEquation),
            static_cast<GL::Renderer::BlendEquation>(new_mode.alphaEquation)
        );

        cache = new_mode;
    }

    init = true;
}
Vladimír Vondruš
@mosra
ah i see, sorry, did a lazy search and it didn't find Renderer .. now i see it :)
hsdk123
@hsdk123
No problem, I'm sorry I couldn't clean up the code more
Vladimír Vondruš
@mosra
how does it look if you use One / OneMinusSourceAlpha for both RGB and Alpha?
hsdk123
@hsdk123
image.png
Bright white
Jordan Peck
@Auburn
WSL2 has hardware accelerated GUI support in Windows 11 :O
Guillaume Jacquemin
@williamjcm
I'm personally not too thrilled about Windows 11, to be honest.
By the time Windows 10 goes out of support, I'm sure Linux will run pretty much everything I run on Windows, either natively or through Wine/Proton.
Vladimír Vondruš
@mosra
@hsdk123 sorry, had to leave early yesterday .. this looks closer to the ideal, what's special about the bottom row that it gets treated differently? can you also try SourceAlpha / OneMinusSourceAlpha?
Fo Nz
@FoNz99089892_twitter

image.png

This could be a blending function mistake. It happened to me. If you are working on 2D (for GUI, to say...), disable depth test and clear on RGB channels.

hsdk123
@hsdk123

@mosra

what's special about the bottom row

The bottom row, for both images, is semi-transparent. I think that's what's causing it

hsdk123
@hsdk123
image.png
SourceAlpha / OneMinusSourceAlpha
@FoNz99089892_twitter
I was so hoping disabling depth test would work, but sadly it didn't. Any other ideas?
hsdk123
@hsdk123
@mosra
I'm using One Zero to overlay the first texture on to the frame buffer - would this be incorrect?
Vladimír Vondruš
@mosra
i have no better suggestion than loading the two textures in https://www.andersriggelsen.dk/glblendfunc.php and doing trial&error until it does the right thing
Igal Alkon
@alkavan

I'm having some trouble drawing multiple lines in 3D space. In Drawable3D::draw() have this:

_buffer.setData(_lines, GL::BufferUsage::StreamDraw);
_mesh.setCount(_lines.size());

I added 4 points to the _lines vector, but only two (one line) is drawn. GL::BufferUsage::StreamDraw is not the way?

Hans Loeblich
@thehans
Is there documentation on how to get started with a user-defined shader? I think I was reading such a page the other day, but can't find it now. The overall organization of the docs is very confusing to me.
Guillaume Jacquemin
@williamjcm
IMO, the best documentation is the textured triangle example.
It'll only show the Magnum way of using a custom shader, though, so if you need help writing the actual shader code, there are other resources for that.
Hans Loeblich
@thehans
ok, I'll review that one, thanks. 2nd question, just curious is there a list of projects which use Magnum?
I think i've got the GLSL aspect of it covered, no worries.
Guillaume Jacquemin
@williamjcm

2nd question, just curious is there a list of projects which use Magnum?

I don't remember seeing one of these on the website itself, but the blog post announcing the 2020.06 release mentions a few of them, and other posts might mention more.

Vladimír Vondruš
@mosra

@alkavan how did you add the vertex buffer to the mesh? how are the attributes set up? for example, if the mesh would expect a position and a normal (for whatever reasons) for every vertex but you specify just positions, then it ends up looking at just half of the points

the BufferUsage has nothing to do with this, it's merely a suggestion to the driver where to best put the memory

Igal Alkon
@alkavan
@mosra I already found the issue, kind of stupid. It all worked actually, the issue was I also have a wireframe grid, at y=0.0 and the other lines I added were exactly where grid is and so I didn't see them :)
Vladimír Vondruš
@mosra
ahah :)

@thehans out of the public projects, there's also habitat-sim, and you can find various projects under the #magnum topic on github: https://github.com/topics/magnum

The overall organization of the docs is very confusing to me.

do you have an idea how it could be improved? regular users get blind to the deficiencies over time, so fresh ideas are always welcome :)

11 replies
Igal Alkon
@alkavan

btw, something just a little annoying, CLion (Clang-Tidy) inspection produce a warning on:

_mesh.setCount(_lines.size());
// Clang-Tidy: Narrowing conversion from 'std::vector::size_type' (aka 'unsigned long') to signed type 'Magnum::Int' (aka 'int') is implementation-defined

I can do Magnum::Int(_lines.size()), this part if I'm not wrong taken from an example, this how I should do it?

Vladimír Vondruš
@mosra
clang tidy is a bit overmotivated, i'd say
the relevant GL API takes a (signed) int, and if i'd make setCount(std::size_t), then it would complain if passing an int to it again
Guillaume Jacquemin
@williamjcm
Today, I learnt Magnum types such as Color4 or Vector3 were trivially copyable, and thus made one of my struct types trivially copyable as well.
Fo Nz
@FoNz99089892_twitter

Today, I learnt Magnum types such as Color4 or Vector3 were trivially copyable, and thus made one of my struct types trivially copyable as well.

As I saw, basically they have a data method where it returns the base address for the internal array. I think you can just memcpy them.

Jordan Peck
@Auburn
@mosra I've updated my Nvidia drivers to latest version on Windows and I'm now having an issue with ImGui not correctly handling alpha
image.png
ImGui is rendering a fullscreen quad with this color data
I'm sure it is caused by the driver update, since a user was having the issue on the latest driver. So I updated then I had the same issue
Fo Nz
@FoNz99089892_twitter
I'm trying to use AnySceneImporter on iOS, but when it's loaded by the PluginManager, the application says that the plugin is not present. I can see the library being statically linked into my Xcode project. I all the dependencies by myself. What's the error? Any idea? Thanks in advance.
Jordan Peck
@Auburn
I found a fix by changing ImGui window flags, seems odd though that a driver update would cause the behaviour to change? I would have thought OpenGL doesn't get touched much these days
Vladimír Vondruš
@mosra
@Auburn what was the flag that fixed it? all i can think of is the new driver not clearing framebuffer attachments by default (or vice versa) so you end up with something different if you forgot to clear explicitly

@FoNz99089892_twitter if you're not using CMake to link the static plugins, you have to perform an additional step to register them for the plugin manager, basically the following in a file that's compiled directly to the final executable (and not any intermediate static library):

#include <MagnumPlugins/AnySceneImporter/importStaticPlugin.cpp>

Relevant docs: https://doc.magnum.graphics/magnum/plugins.html#plugins-static

Fo Nz
@FoNz99089892_twitter
@mosra Thanks a lot! I completely missed that.
Jordan Peck
@Auburn
@mosra It was this flag for a dock node, which in turn sets the fullscreen imgui window flag ImGuiWindowFlags_NoBackground https://github.com/Auburn/FastNoise2/commit/732577d86dbdf7f79de949b86c3ef3589ba82699#diff-13f4704b60755926950ac5d2b0ca1e4850f8a69d0a51ebc2cce9418b8dfefa95L550
if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode) host_window_flags |= ImGuiWindowFlags_NoBackground;
Which makes me wonder how it was working before...