当前位置: 首页>>代码示例>>C++>>正文


C++ TextureCache::fetchAndPin方法代码示例

本文整理汇总了C++中TextureCache::fetchAndPin方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureCache::fetchAndPin方法的具体用法?C++ TextureCache::fetchAndPin怎么用?C++ TextureCache::fetchAndPin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextureCache的用法示例。


在下文中一共展示了TextureCache::fetchAndPin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prepareTexture

//
// only call this function immediately after GetOverlayList()
// which will ensure the list of texture id's are valid
//
int gstTextureManager::prepareTexture(TexTile& tile,
                                      const gstTextureGuard &tex) {
  // if no secondary textures have been loaded, return immediately
  if (getCurrTexID() == 0)
    return -1;

  tile.src = tex->id();

  // determine what is the best tile that exists in our db
  TileExistance* te = tile_existance_cache_->fetch(tile.addr());

  assert(te != NULL);

  // no texture available
  if (te->bestAvailable == 0)
    return -1;


  // now try to get this best one, but take anything less as long
  // as we can get something immediately
  // this will fill our read queue with everything from this tile
  // all the way up the stack until we've found a tile

  requested_level_ = LEVFROMADDR(te->bestAvailable);
  while (tile.lev > requested_level_)
    tile.upLevel();

  uint texid;
  TextureCache* textureCache = tile.alpha() == 0 ? overlay_RGB_texture_cache_ :
                               overlay_alpha_texture_cache_;
  while ((texid = textureCache->fetchAndPin(tile.addr())) == 0) {
    if (tile.upLevel() == -1)
      return -1;
  }

  // we found one, so let's load it up!
  glBindTexture(GL_TEXTURE_2D, texid);

  return tile.lev;
}
开发者ID:zhanghaoit445,项目名称:earthenterprise,代码行数:44,代码来源:gstTextureManager.cpp


注:本文中的TextureCache::fetchAndPin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。