issue #2388: Checking whether the texture exists.
issue #2388: One more static_cast.