Alex
Alex

Reputation: 151

Zoom invariant objects in webgl

WebGl doesn't support line thickness. So when I need to highlight some line, I just draw rectangle around it. But when I zoom scene it looks pretty scary.

There are two ways I see now:

1) Recalculate rectangle width according to canvas.width into model coordinates.

2) Place all zoom-invariant objects under separate matrix (I use scenejs) and recalculate their positions after each mousewheel

I don't like both of this solution. So I wonder: is there good workaround to make items zoom invariant?

Upvotes: 3

Views: 321

Answers (1)

Petr Broz
Petr Broz

Reputation: 9942

Another way around that (not the most efficient one though) might be to use shaders. In our WebGL app, we render highlighted primitives into a texture and then blur it back on screen to add a "selection glow effect".

Upvotes: 0

Related Questions