@ -83,7 +83,53 @@ template<UnsignedInt dimensions> Texture<dimensions> Texture<dimensions>::view(T
return out ;
}
/* Other view() overloads at the end */
/* On Windows (MSVC, clang-cl and MinGw) these need an explicit export
otherwise the symbol doesn ' t get exported . */
# ifndef MAGNUM_TARGET_GLES
template < > template < > MAGNUM_GL_EXPORT Texture1D Texture1D : : view ( Texture1DArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture1D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
# endif
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( Texture2DArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( CubeMapTexture & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( CubeMapTextureArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
# endif
# ifndef MAGNUM_TARGET_GLES
@ -135,66 +181,29 @@ template<UnsignedInt dimensions> Texture<dimensions>& Texture<dimensions>::setLa
}
# endif
# ifndef DOXYGEN_GENERATING_OUTPUT
# ifndef MAGNUM_TARGET_GLES
template class MAGNUM_GL_EXPORT Texture < 1 > ;
template class
/* GCC needs the export macro on the class definition (and here it warns
that the type is already defined so the export is ignored ) , while Clang
and MSVC need it here ( and ignore it on the declaration ) */
# if defined(CORRADE_TARGET_CLANG) || defined(CORRADE_TARGET_MSVC)
MAGNUM_GL_EXPORT
# endif
Texture < 1 > ;
# endif
# if !defined(MAGNUM_TARGET_GLES) || !defined(MAGNUM_TARGET_WEBGL)
template class MAGNUM_GL_EXPORT Texture < 2 > ;
template class MAGNUM_GL_EXPORT Texture < 3 > ;
# endif
# if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* Because these refer to concrete types different than the class itself, they
have to be after the explicit type instantiations . Additionally , on Windows
( MSVC , clang - cl and MinGw ) these need an explicit export otherwise the
symbol doesn ' t get exported .
Other view ( ) overloads at the top . */
# ifndef MAGNUM_TARGET_GLES
template < > template < > MAGNUM_GL_EXPORT Texture1D Texture1D : : view ( Texture1DArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture1D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
template class
# if defined(CORRADE_TARGET_CLANG) || defined(CORRADE_TARGET_MSVC)
MAGNUM_GL_EXPORT
# endif
Texture < 2 > ;
template class
# if defined(CORRADE_TARGET_CLANG) || defined(CORRADE_TARGET_MSVC)
MAGNUM_GL_EXPORT
# endif
Texture < 3 > ;
# endif
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( Texture2DArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( CubeMapTexture & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
template < > template < > MAGNUM_GL_EXPORT Texture2D Texture2D : : view ( CubeMapTextureArray & original , const TextureFormat internalFormat , const Int levelOffset , const Int levelCount , const Int layer ) {
/* glTextureView() doesn't work with glCreateTextures() as it needs an
object without a name bound , so have to construct manually . The object
is marked as Created as glTextureView ( ) binds the name . */
GLuint id ;
glGenTextures ( 1 , & id ) ;
Texture2D out { id , ObjectFlag : : Created | ObjectFlag : : DeleteOnDestruction } ;
out . viewInternal ( original , internalFormat , levelOffset , levelCount , layer , 1 ) ;
return out ;
}
# endif
} }