Пример #1
0
Texture::Texture( const Surface32f &surface, Format format )
	: mObj( shared_ptr<Obj>( new Obj( surface.getWidth(), surface.getHeight() ) ) )
{
	if( format.mInternalFormat < 0 ) {
#if ! defined( CINDER_GLES )
		if( GLEE_ARB_texture_float )
			format.mInternalFormat = surface.hasAlpha() ? GL_RGBA32F_ARB : GL_RGB32F_ARB;
		else
			format.mInternalFormat = surface.hasAlpha() ? GL_RGBA : GL_RGB;
#else
		format.mInternalFormat = surface.hasAlpha() ? GL_RGBA : GL_RGB;
#endif	
	}
	mObj->mInternalFormat = format.mInternalFormat;
	mObj->mTarget = format.mTarget;

	init( surface.getData(), surface.hasAlpha()?GL_RGBA:GL_RGB, format );	
}
Пример #2
0
Texture::Texture( const Surface32f &surface, Format format )
	: mObj( shared_ptr<Obj>( new Obj( surface.getWidth(), surface.getHeight() ) ) )
{
#if defined( CINDER_MAC )
	bool supportsTextureFloat = gl::isExtensionAvailable( "GL_ARB_texture_float" );
#elif defined( CINDER_MSW )
	bool supportsTextureFloat = GLEE_ARB_texture_float != 0;
#endif

	if( format.mInternalFormat < 0 ) {
#if ! defined( CINDER_GLES )
		if( supportsTextureFloat )
			format.mInternalFormat = surface.hasAlpha() ? GL_RGBA32F_ARB : GL_RGB32F_ARB;
		else
			format.mInternalFormat = surface.hasAlpha() ? GL_RGBA : GL_RGB;
#else
		format.mInternalFormat = surface.hasAlpha() ? GL_RGBA : GL_RGB;
#endif	
	}
	mObj->mInternalFormat = format.mInternalFormat;
	mObj->mTarget = format.mTarget;

	init( surface.getData(), surface.hasAlpha()?GL_RGBA:GL_RGB, format );	
}