| 487 | } |
| 488 | |
| 489 | boost::shared_ptr<GLShader> |
| 490 | OSGLContext::getOrCreateMaskMixShader(bool maskEnabled) |
| 491 | { |
| 492 | int shader_i = maskEnabled ? 1 : 0; |
| 493 | |
| 494 | if (_imp->applyMaskMixShader[shader_i]) { |
| 495 | return _imp->applyMaskMixShader[shader_i]; |
| 496 | } |
| 497 | _imp->applyMaskMixShader[shader_i].reset( new GLShader() ); |
| 498 | |
| 499 | std::string fragmentSource; |
| 500 | if (maskEnabled) { |
| 501 | fragmentSource += "#define MASK_ENABLED\n"; |
| 502 | } |
| 503 | |
| 504 | fragmentSource += std::string(applyMaskMix_FragmentShader); |
| 505 | |
| 506 | #ifdef DEBUG |
| 507 | std::string error; |
| 508 | bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), &error); |
| 509 | if (!ok) { |
| 510 | qDebug() << error.c_str(); |
| 511 | } |
| 512 | #else |
| 513 | bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), 0); |
| 514 | #endif |
| 515 | assert(ok); |
| 516 | #ifdef DEBUG |
| 517 | ok = _imp->applyMaskMixShader[shader_i]->link(&error); |
| 518 | if (!ok) { |
| 519 | qDebug() << error.c_str(); |
| 520 | } |
| 521 | #else |
| 522 | ok = _imp->applyMaskMixShader[shader_i]->link(); |
| 523 | #endif |
| 524 | assert(ok); |
| 525 | Q_UNUSED(ok); |
| 526 | |
| 527 | return _imp->applyMaskMixShader[shader_i]; |
| 528 | } |
| 529 | |
| 530 | boost::shared_ptr<GLShader> |
| 531 | OSGLContext::getOrCreateCopyUnprocessedChannelsShader(bool doR, |
no test coverage detected