本文整理汇总了C++中QEglProperties::setPixelFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ QEglProperties::setPixelFormat方法的具体用法?C++ QEglProperties::setPixelFormat怎么用?C++ QEglProperties::setPixelFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QEglProperties
的用法示例。
在下文中一共展示了QEglProperties::setPixelFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qt_egl_add_platform_config
void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device)
{
// Find the QGLScreen for this paint device.
QGLScreen *glScreen = glScreenForDevice(device);
if (!glScreen) {
qWarning("QGLContext::chooseContext(): The screen is not a QGLScreen");
return;
}
int devType = device->devType();
if (devType == QInternal::Image)
props.setPixelFormat(static_cast<QImage *>(device)->format());
else
props.setPixelFormat(glScreen->pixelFormat());
}
示例2: QEglContext
static QEglContext *createContext(QPaintDevice *device)
{
QEglContext *context;
// Create the context object and open the display.
context = new QEglContext();
context->setApi(QEgl::OpenVG);
if (!context->openDisplay(device)) {
delete context;
return 0;
}
// Set the swap interval for the display.
QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL");
if (!interval.isEmpty())
eglSwapInterval(context->display(), interval.toInt());
else
eglSwapInterval(context->display(), 1);
// Choose an appropriate configuration for rendering into the device.
QEglProperties configProps;
configProps.setPaintDeviceFormat(device);
int redSize = configProps.value(EGL_RED_SIZE);
if (redSize == EGL_DONT_CARE || redSize == 0)
configProps.setPixelFormat(QImage::Format_ARGB32); // XXX
#ifndef QVG_SCISSOR_CLIP
// If we are using the mask to clip, then explicitly request a mask.
configProps.setValue(EGL_ALPHA_MASK_SIZE, 1);
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT |
EGL_VG_ALPHA_FORMAT_PRE_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
// Try again without the "pre" bit.
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT);
if (!context->chooseConfig(configProps)) {
delete context;
return 0;
}
}
#else
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
delete context;
return 0;
}
#endif
// Construct a new EGL context for the selected configuration.
if (!context->createContext()) {
delete context;
return 0;
}
return context;
}
示例3: QEglContext
static QEglContext *createContext(QPaintDevice *device)
{
QEglContext *context;
// Create the context object and open the display.
context = new QEglContext();
context->setApi(QEgl::OpenVG);
// Set the swap interval for the display.
QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL");
if (!interval.isEmpty())
eglSwapInterval(QEgl::display(), interval.toInt());
else
eglSwapInterval(QEgl::display(), 1);
#ifdef EGL_RENDERABLE_TYPE
// Has the user specified an explicit EGL configuration to use?
QByteArray configId = qgetenv("QT_VG_EGL_CONFIG");
if (!configId.isEmpty()) {
EGLint cfgId = configId.toInt();
EGLint properties[] = {
EGL_CONFIG_ID, cfgId,
EGL_NONE
};
EGLint matching = 0;
EGLConfig cfg;
if (eglChooseConfig
(QEgl::display(), properties, &cfg, 1, &matching) &&
matching > 0) {
// Check that the selected configuration actually supports OpenVG
// and then create the context with it.
EGLint id = 0;
EGLint type = 0;
eglGetConfigAttrib
(QEgl::display(), cfg, EGL_CONFIG_ID, &id);
eglGetConfigAttrib
(QEgl::display(), cfg, EGL_RENDERABLE_TYPE, &type);
if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) {
context->setConfig(cfg);
if (!context->createContext()) {
delete context;
return 0;
}
return context;
} else {
qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId));
}
}
}
#endif
// Choose an appropriate configuration for rendering into the device.
QEglProperties configProps;
configProps.setPaintDeviceFormat(device);
int redSize = configProps.value(EGL_RED_SIZE);
if (redSize == EGL_DONT_CARE || redSize == 0)
configProps.setPixelFormat(QImage::Format_ARGB32); // XXX
#ifndef QVG_SCISSOR_CLIP
// If we are using the mask to clip, then explicitly request a mask.
configProps.setValue(EGL_ALPHA_MASK_SIZE, 1);
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT |
EGL_VG_ALPHA_FORMAT_PRE_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
// Try again without the "pre" bit.
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
if (!context->chooseConfig(configProps)) {
delete context;
return 0;
}
}
#else
configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
delete context;
return 0;
}
#endif
// Construct a new EGL context for the selected configuration.
if (!context->createContext()) {
delete context;
return 0;
}
return context;
}
示例4: qt_egl_add_platform_config
void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device)
{
if (device->devType() == QInternal::Image)
props.setPixelFormat(static_cast<QImage *>(device)->format());
}