As Tibur said, an easy way to do this is to use a debugging texture that has a different color for each level, as shown here .
Now, if you need to calculate the mipmap level manually (usually this is a floating point value), this is another story as you will need derivatives, but this should put you in the way.
source
share