Called by initData( ImageSourceRef ) when the user has NOT supplied an intermediate PBO
| 1347 | |
| 1348 | // Called by initData( ImageSourceRef ) when the user has NOT supplied an intermediate PBO |
| 1349 | void Texture2d::initDataImageSourceImpl( const ImageSourceRef &imageSource, const Format & /*format*/, GLint dataFormat, GLint dataType, ImageIo::ChannelOrder channelOrder, bool isGray ) |
| 1350 | { |
| 1351 | if( imageSource->getDataType() == ImageIo::UINT8 ) { |
| 1352 | auto target = ImageTargetGlTexture<uint8_t>::create( this, channelOrder, isGray, imageSource->hasAlpha() ); |
| 1353 | imageSource->load( target ); |
| 1354 | glTexImage2D( mTarget, 0, mInternalFormat, mActualSize.x, mActualSize.y, 0, dataFormat, dataType, target->getData() ); |
| 1355 | } |
| 1356 | else if( imageSource->getDataType() == ImageIo::UINT16 ) { |
| 1357 | auto target = ImageTargetGlTexture<uint16_t>::create( this, channelOrder, isGray, imageSource->hasAlpha() ); |
| 1358 | imageSource->load( target ); |
| 1359 | glTexImage2D( mTarget, 0, mInternalFormat, mActualSize.x, mActualSize.y, 0, dataFormat, dataType, target->getData() ); |
| 1360 | |
| 1361 | } |
| 1362 | else if( imageSource->getDataType() == ImageIo::FLOAT16 ) { |
| 1363 | auto target = ImageTargetGlTexture<half_float>::create( this, channelOrder, isGray, imageSource->hasAlpha() ); |
| 1364 | imageSource->load( target ); |
| 1365 | #if defined( CINDER_GL_ES_2 ) |
| 1366 | glTexImage2D( mTarget, 0, mInternalFormat, mActualSize.x, mActualSize.y, 0, dataFormat, dataType, target->getData() ); |
| 1367 | #else |
| 1368 | glTexImage2D( mTarget, 0, mInternalFormat, mActualSize.x, mActualSize.y, 0, dataFormat, dataType, target->getData() ); |
| 1369 | #endif |
| 1370 | |
| 1371 | } |
| 1372 | else { |
| 1373 | auto target = ImageTargetGlTexture<float>::create( this, channelOrder, isGray, imageSource->hasAlpha() ); |
| 1374 | imageSource->load( target ); |
| 1375 | glTexImage2D( mTarget, 0, mInternalFormat, mActualSize.x, mActualSize.y, 0, dataFormat, dataType, target->getData() ); |
| 1376 | } |
| 1377 | } |
| 1378 | |
| 1379 | void Texture2d::initData( const ImageSourceRef &imageSource, const Format &format ) |
| 1380 | { |