| 269 | }; |
| 270 | |
| 271 | void |
| 272 | ViewerGL::paintGL() |
| 273 | { |
| 274 | // always running in the main thread |
| 275 | assert( qApp && qApp->thread() == QThread::currentThread() ); |
| 276 | |
| 277 | //if app is closing, just return |
| 278 | if ( !_imp->viewerTab->getGui() ) { |
| 279 | return; |
| 280 | } |
| 281 | glCheckError(); |
| 282 | |
| 283 | |
| 284 | { |
| 285 | double screenPixelRatio = getScreenPixelRatio(); |
| 286 | if (screenPixelRatio != _imp->_screenPixelRatio) { |
| 287 | _imp->_screenPixelRatio = screenPixelRatio; |
| 288 | _imp->_textFont.reset(new QFont(appFont, appFontSize * screenPixelRatio)); |
| 289 | } |
| 290 | } |
| 291 | assert(_imp->_textFont); |
| 292 | |
| 293 | double zoomLeft, zoomRight, zoomBottom, zoomTop; |
| 294 | { |
| 295 | QMutexLocker l(&_imp->zoomCtxMutex); |
| 296 | assert(0 < _imp->zoomCtx.factor() && _imp->zoomCtx.factor() <= 1024); |
| 297 | zoomLeft = _imp->zoomCtx.left(); |
| 298 | zoomRight = _imp->zoomCtx.right(); |
| 299 | zoomBottom = _imp->zoomCtx.bottom(); |
| 300 | zoomTop = _imp->zoomCtx.top(); |
| 301 | } |
| 302 | if ( (zoomLeft == zoomRight) || (zoomTop == zoomBottom) ) { |
| 303 | clearColorBuffer( _imp->clearColor.redF(), _imp->clearColor.greenF(), _imp->clearColor.blueF(), _imp->clearColor.alphaF() ); |
| 304 | glCheckError(); |
| 305 | |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | { |
| 310 | //GLProtectAttrib a(GL_TRANSFORM_BIT); // GL_MODELVIEW is active by default |
| 311 | |
| 312 | // Note: the OFX spec says that the GL_MODELVIEW should be the identity matrix |
| 313 | // http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#ImageEffectOverlays |
| 314 | // However, |
| 315 | // - Nuke uses a different matrix (RoD.width is the width of the RoD of the displayed image) |
| 316 | // - Nuke transforms the interacts using the modelview if there are Transform nodes between the viewer and the interact. |
| 317 | |
| 318 | |
| 319 | glMatrixMode(GL_PROJECTION); |
| 320 | glLoadIdentity(); |
| 321 | glOrtho(zoomLeft, zoomRight, zoomBottom, zoomTop, -1, 1); |
| 322 | _imp->glShadow.setX( (zoomRight - zoomLeft) / width() ); |
| 323 | _imp->glShadow.setY( (zoomTop - zoomBottom) / height() ); |
| 324 | //glScalef(RoD.width, RoD.width, 1.0); // for compatibility with Nuke |
| 325 | //glTranslatef(1, 1, 0); // for compatibility with Nuke |
| 326 | glMatrixMode(GL_MODELVIEW); |
| 327 | glLoadIdentity(); |
| 328 | //glTranslatef(-1, -1, 0); // for compatibility with Nuke |
nothing calls this directly
no test coverage detected