You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
In order to implement »layered« rendering, i would like to have a background and a foregroundsampler2D in the shader. When i do this, the compiler complains that i am trying to use the same texture unit. Even when i try to assign another one, it doesn’t work. Some resources say, the texture unit should be set right after linking. Is this possible with PShader or do i need fallback to JOGL, or is the problem something entirely different?
Many thanks in advance for any hints!
The text was updated successfully, but these errors were encountered:
Hey @codeanticode,
thanks for the hint; indeed, this was the approach. Alas, it generates following error message:
java.lang.RuntimeException: Cannot validate shader program:
Validation Failed: Sampler error:
Samplers of different types use the same texture image unit.
- or -
A sampler's texture unit is out of range (greater than max allowed or negative).
@diroruthis discussion on stack overflow sheds some light on the problem. Because validation in PShader happens before the texture units are bound, the compiler cannot determine if the same unit will be assigned to both the 2D and cube samplers. A hack mentioned in the stack overflow thread is to remove the validation step. I commented the validation() call in PShader, and the modified cube shader with background texture does works You could subclass PShader in planetarium, and overload the init() method.
Seems that they had the same problem with the Allosphere :-)
In order to implement »layered« rendering, i would like to have a background and a foreground
sampler2D
in the shader. When i do this, the compiler complains that i am trying to use the same texture unit. Even when i try to assign another one, it doesn’t work. Some resources say, the texture unit should be set right after linking. Is this possible with PShader or do i need fallback to JOGL, or is the problem something entirely different?Many thanks in advance for any hints!
The text was updated successfully, but these errors were encountered: