void NativeWindowRenderer::glThread() {
    initializeEGL();
    createPrograms();

    Mutex::Autolock autoLock(mLock);
    bool quit = false;
    while (!quit) {
        switch (mThreadCmd) {
            case CMD_IDLE:
                mCond.wait(mLock);
                continue;
            case CMD_RENDER_INPUT:
                render(mThreadRenderInput);
                break;
            case CMD_RESERVE_TEXTURE:
                glBindTexture(GL_TEXTURE_EXTERNAL_OES, mThreadTextureId);
                CHECK_GL_ERROR;
                break;
            case CMD_DELETE_TEXTURE:
                glDeleteTextures(1, &mThreadTextureId);
                break;
            case CMD_QUIT:
                terminateEGL();
                quit = true;
                break;
        }
        // Tell the requester that the command is finished.
        mThreadCmd = CMD_IDLE;
        mCond.broadcast();
    }
    ALOGD("quit");
}
void ShaderManager::LoadShaderFiles(std::vector<std::string> &program_names)
{
  std::string directory;

  //Load and compile the shaders
  directory = project_mode_string + "vertex_shaders.txt";
  compileShaders(GL_VERTEX_SHADER, directory);
  directory = project_mode_string + "fragment_shaders.txt";
  compileShaders(GL_FRAGMENT_SHADER, directory);
  //Link the programs
  createPrograms();

  //Get shader names to send back
  SPIterator it = shader_programs.begin();
  for(; it!= shader_programs.end(); it++)
  {
    program_names.push_back((*it).first);
  }
}