question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(question) how to composite multiple children using blendFunc

See original GitHub issue

question

library version

3.6.0

npm ls gl-react gl-react-dom gl-react-native gl-react-expo
gl-react@3.6.0 
└── gl-react-dom@3.6.0

This should be a relatively simple question, but I’m not seeing an easy way to composite multiple nodes together while being able to take advantage of the parent node’s blendFunc.

The only way I can currently see of implementing this is to re-implement the blendFunc in the parent node’s shader and have the multiple children passed in as textures, but this seems really backwards, so I’m guessing I’m missing something. None of the examples really use blendFunc or composite multiple children together.

Here’s a jsfiddle with a DOM example of what I’m trying to accomplish.

Also, I absolutely love using gl-react – keep up the great work!! 😃

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
transitive-bullshitcommented, Jul 19, 2017

I agree this should be a gl-react primitive. I’d go with Layer singular as it’s one fbo surface with multiple child nodes.

There’s a precedent we can learn from in every retained scenegraph. The only other option I could see is that we don’t introduce a new Node type, and instead, Node recognizes if it has multiple children and uses its blendFunc to blend them on top of each other in this specific case. This is what I thought would happen, for instance, the first time I tried using gl-react. That being said, I’d prefer to stick with the explicit Layer container for now.

0reactions
quaoscommented, Nov 2, 2021

Hi, Any progress on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using multiple blendfunc OpenGL - alpha - Stack Overflow
You can create an offscreen Framebuffer Object with a texture attached to it. Perform the first render using glBlendFunc(GL_ONE, GL_ONE) then flip the...
Read more >
WebGLRenderingContext.blendFunc() - Web APIs | MDN
The WebGLRenderingContext.blendFunc() method of the WebGL API defines which function is used for blending pixel arithmetic.
Read more >
Tips and Tricks - deck.gl
Note: that there is a caveat with setting mix-blend-mode , as it can affect other peer HTML elements, especially other map children (perhaps...
Read more >
Untitled
... "blendColor", "blendEquation", "blendEquationSeparate", "blendFunc", ... "childElementCount", "childNodes", "children", "chOff", "cite", "city", ...
Read more >
Quick question about blur and bloom : r/opengl - Reddit
Make a copy of the texture. Blur the copy(could be done by downscaling and upscaling if you want performance). combine textures in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found