If I create a render target using WRAP_CLAMP_TO_BORDER as u_wrap and/or v_wrap the engine crashes when I run the code on device. iOS crashes silently and on Android I get “gl error 1280”, which according to the docs means “GL_INVALID_ENUM”.
Ah. It seems like on device, only WRAP_CLAMP_TO_EDGE, WRAP_MIRRORED_REPEAT, or WRAP_REPEAT are implemented (because that’s what GLES 2.0 supports). That means that WRAP_CLAMP_TO_BORDER might be removed from defold altogether to prevent others from getting the problem you’re seeing. We will investigate that and thank you for finding it!
Since I see no way to set the border color, the functionality itself is a bit odd (I guess it would use black?). Perhaps the textures can be redesign to work with clamp to edge instead?
Let me know how it would work for you?
We have graphics.TEXTURE_WRAP_CLAMP_TO_BORDER
for render targets but how do we set the border color? (I guess it is 1.0f ?)
Opengl has GL_TEXTURE_BORDER_COLOR, but I don’t think we set it (or if it’s supported in the render script)
The default color is 0 (glTexParameter - OpenGL 4 Reference Pages)
Also, I think you just won Necromancer of the year?
Thank you, thank you
The graphics script module exposes our internal graphics.h enums, which means that there are enums now that are used by the engine but not by any scripts. if there’s a good use case for it, you should submit a feature request and we’ll consider it!
I’m trying to solve (kind a) the over sampling issue which we have with basic light projections.
According to this article (sorry no direct link to Over Sampling title ) first step is setting the border color to 1.0.
I’m still searching for alternative approaches but can’t find any yet… I just want to try this one.
Later on, a trick is used to solve same issue, but for space behind the far plane of the frustum with just simple coordinates comparison - isn’t the same possible with x and y coordinates when you know the depth buffer size and it’s constant?
As you said, I did something like this. But I’m not properly test it yet, seems OK so far
if (depth_data.t > 1.0 || depth_data.s > 1.0)
shadow = 1.0;