本文整理汇总了C++中KisConfig::useOpenGL方法的典型用法代码示例。如果您正苦于以下问题:C++ KisConfig::useOpenGL方法的具体用法?C++ KisConfig::useOpenGL怎么用?C++ KisConfig::useOpenGL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisConfig
的用法示例。
在下文中一共展示了KisConfig::useOpenGL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotSetDisplayProfile
void KisCanvas2::createCanvas()
{
KisConfig cfg;
slotSetDisplayProfile( KoColorSpaceRegistry::instance()->profileByName(cfg.monitorProfile()) );
if (cfg.useOpenGL()) {
#ifdef HAVE_OPENGL
createOpenGLCanvas();
#else
warnKrita << "OpenGL requested while its not available, starting qpainter canvas";
createQPainterCanvas();
#endif
} else {
createQPainterCanvas();
}
}
示例2: updateProcessor
//.........这里部分代码省略.........
OCIO::MatrixTransformRcPtr swizzle = OCIO::MatrixTransform::Create();
swizzle->setValue(m44, offset);
transform->setChannelView(swizzle);
}
// Post-display transform gamma
{
float exponent = 1.0f/std::max(1e-6f, static_cast<float>(gamma));
const float exponent4f[] = { exponent, exponent, exponent, exponent };
OCIO::ExponentTransformRcPtr expTransform = OCIO::ExponentTransform::Create();
expTransform->setValue(exponent4f);
transform->setDisplayCC(expTransform);
// approximation (no color correction);
approximateTransform->push_back(expTransform);
}
m_processor = config->getProcessor(transform);
m_forwardApproximationProcessor = config->getProcessor(approximateTransform, OCIO::TRANSFORM_DIR_FORWARD);
try {
m_revereseApproximationProcessor = config->getProcessor(approximateTransform, OCIO::TRANSFORM_DIR_INVERSE);
} catch (...) {
warnKrita << "OCIO inverted matrix does not exist!";
//m_revereseApproximationProcessor;
}
#ifdef HAVE_OPENGL
// check whether we are allowed to use shaders -- though that should
// work for everyone these days
KisConfig cfg;
if (!cfg.useOpenGL()) return;
QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
QOpenGLFunctions_3_2_Core *glFuncs3 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
const int lut3DEdgeSize = cfg.ocioLutEdgeSize();
if (m_lut3d.size() == 0) {
//dbgKrita << "generating lut";
glFuncs.glGenTextures(1, &m_lut3dTexID);
int num3Dentries = 3 * lut3DEdgeSize * lut3DEdgeSize * lut3DEdgeSize;
m_lut3d.fill(0.0, num3Dentries);
glFuncs.glActiveTexture(GL_TEXTURE1);
glFuncs.glBindTexture(GL_TEXTURE_3D, m_lut3dTexID);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glFuncs3->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F_ARB,
lut3DEdgeSize, lut3DEdgeSize, lut3DEdgeSize,
0, GL_RGB, GL_FLOAT, &m_lut3d.constData()[0]);
}
// Step 1: Create a GPU Shader Description
OCIO::GpuShaderDesc shaderDesc;
shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_3);
shaderDesc.setFunctionName("OCIODisplay");
shaderDesc.setLut3DEdgeLen(lut3DEdgeSize);