MCPcopy Create free account
hub / github.com/cinder/Cinder / initDataImageSourceImpl

Method initDataImageSourceImpl

src/cinder/gl/Texture.cpp:1349–1377  ·  view source on GitHub ↗

Called by initData( ImageSourceRef ) when the user has NOT supplied an intermediate PBO

Source from the content-addressed store, hash-verified

1347
1348// Called by initData( ImageSourceRef ) when the user has NOT supplied an intermediate PBO
1349void 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
1379void Texture2d::initData( const ImageSourceRef &imageSource, const Format &format )
1380{

Callers

nothing calls this directly

Calls 4

createFunction · 0.50
hasAlphaMethod · 0.45
loadMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected