Determining if sampler2D is valid

Is there a way to determine if a sampler has been given a valid texture? I am trying to draw a world in which some objects are textured and some are not. However, in the fragment shader I have not found a way to determine if the texture should be accessed.

Perhaps the preferred method is to use two separate fragment shaders, one for textured polygons and one for non-textured polygons. Is this the case?


From in the fragment shader you can’t do that, but you could use easily an uniform boolean variable to tell the fragment shader if the texture should be accesed.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.