コード例 #1
0
void OpenGLComponent::updateContext()
{
    if (needToDeleteContext)
        deleteContext();

    if (context == nullptr)
    {
        const ScopedLock sl (contextLock);

        if (context == nullptr)
        {
            context = createContext();

            if (context != nullptr)
            {
               #if JUCE_LINUX
                if (! isUsingDedicatedThread())
               #endif
                    updateContextPosition();

                if (context->makeActive())
                {
                    newOpenGLContextCreated();
                    context->makeInactive();
                }
            }
        }
    }
}
コード例 #2
0
OpenGLComponent::~OpenGLComponent()
{
    if (isUsingDedicatedThread())
        stopBackgroundThread();
    else
        deleteContext();

    componentWatcher = nullptr;
}
コード例 #3
0
ファイル: buffer.cpp プロジェクト: mylxiaoyi/ros_distro
bool Buffer::checkAndErrorDedicatedThreadPresent(std::string* error_str) const
{
  if (isUsingDedicatedThread())
    return true;
  


  if (error_str)
    *error_str = tf2_ros::threading_error;

  ROS_ERROR("%s", tf2_ros::threading_error.c_str());
  return false;
}
コード例 #4
0
OpenGLComponent::~OpenGLComponent()
{
    if (isUsingDedicatedThread())
    {
        /* If you're using a background thread, then your sub-class MUST call
           stopRenderThread() in its destructor! Otherwise, the thread could still
           be running while your sub-class isbeing destroyed, and so may make a call
           to your subclass's renderOpenGL() method when it no longer exists!
        */
        jassert (renderThread == nullptr);

        stopRenderThread();
    }
    else
    {
        deleteContext();
    }

    componentWatcher = nullptr;
}