You get a circular include path of TextureGL.h includes Texture.h which includes TexturePi.h which includes TextureGL.h (which gets skipped due to the pragma once) which means the derivation from CGLTexture fails.
My change fixes the TexturePi case, and I think it does the right thing for TextureGL case.