Example #1
0
void QGLFrame::getCodeChanged(QString newCode)
{
    this->code =  newCode;
    stopRenderThread();
    initRenderThread();
    RenderThread.doRendering=true;
}
Example #2
0
void QGLFrame::handleCodeChange(QObject *glslwptr)
{
    this->code=((GLSLEditor*)glslwptr)->editor->toPlainText();
    stopRenderThread();
    initRenderThread();
    RenderThread.doRendering=true;
}
void OpenGLComponent::stopBackgroundThread()
{
    if (threadStarted)
    {
        stopRenderThread();
        threadStarted = false;
    }
}
Example #4
0
void QGLFrame::openFileDialog()
{
    QString filePath = QFileDialog::getOpenFileName(this,tr("Fragment Shader File"),"./../Shadertoy",tr("Files (*.fsh)"));
    qDebug()<<filePath;
    QFile fShaderFile(filePath);

    if(fShaderFile.open(QFile::ReadOnly | QFile::Text))
    {
        this->code =  fShaderFile.readAll();
        stopRenderThread();
        initRenderThread();
        RenderThread.doRendering=true;
        emit sendCode(this->code);
    }
    else
        qDebug() <<"Error unable to open file:" << filePath;
}
Example #5
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;
}
Example #6
0
void QGLFrame::closeEvent(QCloseEvent *evt)
{
    stopRenderThread();
    QGLWidget::closeEvent(evt);
}