MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / initializeGL

Method initializeGL

Gui/Histogram.cpp:687–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687void
688Histogram::initializeGL()
689{
690 // always running in the main thread
691 assert( qApp && qApp->thread() == QThread::currentThread() );
692 appPTR->initializeOpenGLFunctionsOnce();
693
694 if ( !appPTR->isOpenGLLoaded() ) {
695 return;
696 }
697
698 assert( QOpenGLContext::currentContext() == context() );
699
700
701#ifdef NATRON_HISTOGRAM_USING_OPENGL
702 _imp->histogramComputingShader.reset( new QOpenGLShaderProgram( context() ) );
703 if ( !_imp->histogramComputingShader->addShaderFromSourceCode(QOpenGLShader::Vertex, histogramComputationVertex_vert) ) {
704 qDebug() << _imp->histogramComputingShader->log();
705 }
706 if ( !_imp->histogramComputingShader->addShaderFromSourceCode(QOpenGLShader::Fragment, histogramComputation_frag) ) {
707 qDebug() << _imp->histogramComputingShader->log();
708 }
709 if ( !_imp->histogramComputingShader->link() ) {
710 qDebug() << _imp->histogramComputingShader->log();
711 }
712
713 _imp->histogramMaximumShader.reset( new QOpenGLShaderProgram( context() ) );
714 if ( !_imp->histogramMaximumShader->addShaderFromSourceCode(QOpenGLShader::Fragment, histogramMaximum_frag) ) {
715 qDebug() << _imp->histogramMaximumShader->log();
716 }
717 if ( !_imp->histogramMaximumShader->link() ) {
718 qDebug() << _imp->histogramMaximumShader->log();
719 }
720
721 _imp->histogramRenderingShader.reset( new QOpenGLShaderProgram( context() ) );
722 if ( !_imp->histogramRenderingShader->addShaderFromSourceCode(QOpenGLShader::Vertex, histogramRenderingVertex_vert) ) {
723 qDebug() << _imp->histogramRenderingShader->log();
724 }
725 if ( !_imp->histogramRenderingShader->addShaderFromSourceCode(QOpenGLShader::Fragment, histogramRendering_frag) ) {
726 qDebug() << _imp->histogramRenderingShader->log();
727 }
728 if ( !_imp->histogramRenderingShader->link() ) {
729 qDebug() << _imp->histogramRenderingShader->log();
730 }
731
732 // enable globally : no glPushAttrib()
733 glEnable(GL_TEXTURE_RECTANGLE_ARB);
734
735
736 glGenTextures(3, &_imp->histogramTexture[0]);
737 glGenTextures(3, &_imp->histogramReductionsTexture[0]);
738 glGenTextures(3, &_imp->histogramRenderTexture[0]);
739 glGenTextures(3, &_imp->histogramMaximumTexture[0]);
740
741 _imp->leftImageTexture.reset( new Texture(GL_TEXTURE_RECTANGLE_ARB, GL_NEAREST, GL_NEAREST) );
742 _imp->rightImageTexture.reset( new Texture(GL_TEXTURE_RECTANGLE_ARB, GL_NEAREST, GL_NEAREST) );
743
744 glGenFramebuffers(3, &_imp->fboReductions[0]);

Callers

nothing calls this directly

Calls 6

isOpenGLLoadedMethod · 0.80
linkMethod · 0.80
powFunction · 0.50
resetMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected