Texture RenderTexturePool::Get(int width, int height) { for (std::vector<Texture>::iterator it = g_texturePool.begin(); it != g_texturePool.end(); ++it) if (it->GetWidth() == width && it->GetHeight() == height) { Texture texture = *it; g_texturePool.erase(it); return texture; } Texture handle; Texture_SetHandle(Texture_CreateRenderTarget(width, height), handle); return handle; }
bool Texture::CreateRenderTarget(int width, int height) { if (obj) Texture_Destroy(obj); obj = Texture_CreateRenderTarget(width, height); return obj != NULL; }