Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 20:53
    mrpnk starred mosra/magnum
  • 19:35
    pezcode commented #94
  • 13:21
    celoron starred mosra/magnum
  • 07:31
    dirondin starred mosra/magnum
  • 04:29
    nhatson1987 starred mosra/magnum
  • Jan 27 20:01

    mosra on master

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

  • Jan 27 19:30

    mosra on next

    Shaders: implement object ID te… Shaders: forgot to enable the U… Shaders: more paranoid tests fo… and 2 more (compare)

  • Jan 27 18:49

    mosra on next

    Shaders: add missing MeshVisual… Shaders: add a multidraw MeshVi… Shaders: huh @mosra died mid-se… and 10 more (compare)

  • Jan 27 13:28
    alialhasnawi starred mosra/magnum
  • Jan 27 12:02
    kirin123kirin starred mosra/magnum-singles
  • Jan 27 09:35
    martinekerstedt starred mosra/corrade
  • Jan 27 07:10
  • Jan 27 05:35
    fesoliveira014 starred mosra/magnum-singles
  • Jan 26 14:32
    griels starred mosra/magnum
  • Jan 25 23:15
    Squareys commented #550
  • Jan 25 20:52
    bigbike opened #550
  • Jan 25 17:55

    mosra on next

    doc: minor OCD annoyance. GL: no, not even I know what th… Shaders: implement instancing i… (compare)

  • Jan 25 16:51

    mosra on next

    Shaders: add a multidraw MeshVi… Shaders: huh @mosra died mid-se… Shaders: implement instancing i… and 2 more (compare)

  • Jan 25 15:21

    mosra on master

    Utility: optimize populating la… (compare)

hsdk123
@hsdk123
base.png
(overlay face on base)
I'm using alpha blending when overlaying the textures
Vladimír Vondruš
@mosra
alpha blending is always a trial&error for me :sweat_smile:
what is your clear color set to?
the greyish background above indicates transparency? or is it really just grey
hsdk123
@hsdk123
The grey colour's just the clear colour for the window
The frame buffer that I'm rendering the 2 textures to clears with (0,0,0,0)
Vladimír Vondruš
@mosra
hm there was this neat online tool for figuring out alpha modes somewhere, let me find it
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