コード例 #1
0
//-----------------------------------------------------------------------------
// refreshTexture
//-----------------------------------------------------------------------------
bool GFXD3D9TextureManager::_refreshTexture(GFXTextureObject *texture)
{
   U32 usedStrategies = 0;
   GFXD3D9TextureObject *realTex = static_cast<GFXD3D9TextureObject *>( texture );

   if(texture->mProfile->doStoreBitmap())
   {
//      SAFE_RELEASE(realTex->mD3DTexture);
//      _innerCreateTexture(realTex, texture->mTextureSize.x, texture->mTextureSize.y, texture->mFormat, texture->mProfile, texture->mMipLevels);

      if(texture->mBitmap)
         _loadTexture(texture, texture->mBitmap);

      if(texture->mDDS)
         _loadTexture(texture, texture->mDDS);

      usedStrategies++;
   }

   if(texture->mProfile->isRenderTarget() || texture->mProfile->isDynamic() ||
	   texture->mProfile->isZTarget())
   {
      realTex->release();
      _innerCreateTexture(realTex, texture->getHeight(), texture->getWidth(), texture->getDepth(), texture->mFormat, 

         texture->mProfile, texture->mMipLevels, false, texture->mAntialiasLevel);
      usedStrategies++;
   }

   AssertFatal(usedStrategies < 2, "GFXD3D9TextureManager::_refreshTexture - Inconsistent profile flags!");

   return true;
}
コード例 #2
0
ファイル: Texture.cpp プロジェクト: master-g/hourglass
bool Texture::loadFromFile(const char *path, bool resist)
{
    if (!_loadTexture(path, resist))
    {
        return false;
    }
    
    _makeTexture();
    
    return true;
}
コード例 #3
0
void OpenGlShape::init(const char * vertexShaderFilePath, const char * fragmentShaderFilePath, const char* textureFilename)
{
	glGenVertexArrays(1, &_vertexArrayId);
	glBindVertexArray(_vertexArrayId);

	glGenBuffers(1, &_vertexBuffer);
	glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
	glBufferData(GL_ARRAY_BUFFER, _vertexBufferData.size() * sizeof(GLfloat), &_vertexBufferData.front(), GL_STATIC_DRAW);

	glGenBuffers(1, &_texCoordBuffer);
	glBindBuffer(GL_ARRAY_BUFFER, _texCoordBuffer);
	glBufferData(GL_ARRAY_BUFFER, _textureBufferData.size() * sizeof(GLfloat), &_textureBufferData.front(), GL_STATIC_DRAW);

	_programId = _loadShaders(vertexShaderFilePath, fragmentShaderFilePath);
	
	_matrixId = glGetUniformLocation(_programId, "MVP");

	_loadTexture(textureFilename);
}
コード例 #4
0
ファイル: Texture.cpp プロジェクト: master-g/hourglass
void Texture::load()
{
    if (mLoaded)
    {
        DBGLog("Texture '%s' already loaded.\n", mName.c_str());
        return;
    }
    
    // non resist, can't load from file
    if (!mResist)
    {
        if (!_loadTexture(mPath.c_str()))
            return;
    }
    
    _makeTexture();
    
    _freeTextureData();
    
    mLoaded = true;
}