本文整理汇总了C++中eglGetConfigs函数的典型用法代码示例。如果您正苦于以下问题:C++ eglGetConfigs函数的具体用法?C++ eglGetConfigs怎么用?C++ eglGetConfigs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eglGetConfigs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eglGetCurrentDisplay
QString QGLInfo::reportEGLConfigInfo() const
{
#if !defined(QT_NO_EGL)
QString d;
QEglProperties props;
EGLint count = 0;
EGLDisplay dpy = eglGetCurrentDisplay();
EGLContext ctx = eglGetCurrentContext();
EGLint cfgnum = 0;
if (eglQueryContext(dpy, ctx, EGL_CONFIG_ID, &cfgnum)) {
d += QString("Window configuration in use: ") + QString::number(cfgnum) +
QLatin1String("\n\n");
}
if (!eglGetConfigs(dpy, 0, 0, &count) || count < 1)
return d;
EGLConfig *configs = new EGLConfig [count];
eglGetConfigs(dpy, configs, count, &count);
for (EGLint index = 0; index < count; ++index) {
props = QEglProperties(configs[index]);
d += props.toString() + QLatin1String("\n\n");
}
delete [] configs;
return d;
#else
return QString();
#endif
}
示例2: eglGetConfigs
// Find an EGLConfig that is an exact match for the specified attributes. EGL_FALSE is returned if
// the EGLConfig is found. This indicates that the EGLConfig is not supported.
EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *config)
{
EGLint numConfigs = 0;
eglGetConfigs(dpy, nullptr, 0, &numConfigs);
std::vector<EGLConfig> allConfigs(numConfigs);
eglGetConfigs(dpy, allConfigs.data(), allConfigs.size(), &numConfigs);
for (size_t i = 0; i < allConfigs.size(); i++)
{
bool matchFound = true;
for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2)
{
EGLint actualValue = EGL_DONT_CARE;
eglGetConfigAttrib(dpy, allConfigs[i], curAttrib[0], &actualValue);
if (curAttrib[1] != actualValue)
{
matchFound = false;
break;
}
}
if (matchFound)
{
*config = allConfigs[i];
return EGL_TRUE;
}
}
return EGL_FALSE;
}
示例3: OGRE_EXCEPT
EGLConfig* EGLSupport::getConfigs(GLint *nElements)
{
EGLConfig *configs;
if (eglGetConfigs(mGLDisplay, NULL, 0, nElements) == EGL_FALSE)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Failed to choose config",
__FUNCTION__);
*nElements = 0;
return 0;
}
EGL_CHECK_ERROR
configs = (EGLConfig*) malloc(*nElements * sizeof(EGLConfig));
if (eglGetConfigs(mGLDisplay, configs, *nElements, nElements) == EGL_FALSE)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Failed to choose config",
__FUNCTION__);
*nElements = 0;
free(configs);
return 0;
}
EGL_CHECK_ERROR
return configs;
}
示例4: PrintConfigs
/**
* Print table of all available configurations.
*/
static
EGLConfig* PrintConfigs(EGLDisplay d)
{
EGLConfig *configs;
EGLint numConfigs, i;
if (eglGetConfigs(d, NULL, 0, &numConfigs) != EGL_TRUE)
{
printf ("eglGetConfigs -> %x\n", eglGetError());
exit (EXIT_FAILURE);
}
configs = malloc(sizeof(EGLConfig) *numConfigs);
eglGetConfigs(d, configs, numConfigs, &numConfigs);
printf("Configurations:\n");
printf(" bf lv d st colorbuffer dp st supported \n");
printf(" id sz l b ro r g b a th cl surfaces \n");
printf("----------------------------------------------\n");
for (i = 0; i < numConfigs; i++) {
EGLint id, size, level;
EGLint red, green, blue, alpha;
EGLint depth, stencil;
EGLint surfaces;
EGLint doubleBuf = 1, stereo = 0;
char surfString[100] = "";
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
if (surfaces & EGL_WINDOW_BIT)
strcat(surfString, "win,");
if (surfaces & EGL_PBUFFER_BIT)
strcat(surfString, "pb,");
if (surfaces & EGL_PIXMAP_BIT)
strcat(surfString, "pix,");
if (strlen(surfString) > 0)
surfString[strlen(surfString) - 1] = 0;
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
id, size, level,
doubleBuf ? 'y' : '.',
stereo ? 'y' : '.',
red, green, blue, alpha,
depth, stencil, surfString);
}
// free(configs);
return configs;
}
示例5: _cairo_boilerplate_egl_create_surface
static cairo_surface_t *
_cairo_boilerplate_egl_create_surface (const char *name,
cairo_content_t content,
double width,
double height,
double max_width,
double max_height,
cairo_boilerplate_mode_t mode,
int id,
void **closure)
{
egl_target_closure_t *gltc;
cairo_surface_t *surface;
int major, minor;
EGLConfig *configs;
EGLint numConfigs;
gltc = xcalloc (1, sizeof (egl_target_closure_t));
*closure = gltc;
gltc->dpy = eglGetDisplay (EGL_DEFAULT_DISPLAY);
if (! eglInitialize (gltc->dpy, &major, &minor)) {
free (gltc);
return NULL;
}
eglGetConfigs (gltc->dpy, NULL, 0, &numConfigs);
if (numConfigs == 0) {
free (gltc);
return NULL;
}
configs = xmalloc(sizeof(*configs) *numConfigs);
eglGetConfigs (gltc->dpy, configs, numConfigs, &numConfigs);
eglBindAPI (EGL_OPENGL_API);
gltc->ctx = eglCreateContext (gltc->dpy, configs[0], EGL_NO_CONTEXT, NULL);
if (gltc->ctx == EGL_NO_CONTEXT) {
eglTerminate (gltc->dpy);
free (gltc);
return NULL;
}
gltc->device = cairo_egl_device_create (gltc->dpy, gltc->ctx);
gltc->surface = surface = cairo_gl_surface_create (gltc->device,
content,
ceil (width),
ceil (height));
if (cairo_surface_status (surface))
_cairo_boilerplate_egl_cleanup (gltc);
return surface;
}
示例6: eglGetConfigs
void QEglProperties::dumpAllConfigs()
{
EGLint count = 0;
eglGetConfigs(QEglContext::defaultDisplay(0), 0, 0, &count);
if (count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
eglGetConfigs(QEglContext::defaultDisplay(0), configs, count, &count);
for (EGLint index = 0; index < count; ++index)
qWarning() << QEglProperties(configs[index]).toString();
delete [] configs;
}
示例7: eglGetConfigs
// Dump all of the EGL configurations supported by the system.
void QEgl::dumpAllConfigs()
{
QEglProperties props;
EGLint count = 0;
if (!eglGetConfigs(display(), 0, 0, &count) || count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
eglGetConfigs(display(), configs, count, &count);
for (EGLint index = 0; index < count; ++index) {
props = QEglProperties(configs[index]);
qWarning() << props.toString();
}
delete [] configs;
}
示例8: eglGetConfigs
EGLConfig EGLConfigSelector::findMatchingConfigWithVisualId(NativeVisualId id)
{
if (m_sharedDisplay == EGL_NO_DISPLAY)
return 0;
EGLint numConfigs;
EGLint i;
EGLint visualId;
EGLConfig config = 0;
eglGetConfigs(m_sharedDisplay, 0, 0, &numConfigs);
if (!numConfigs) {
LOG_ERROR("Failed to retrieve any EGL configs.");
return 0;
}
EGLConfig configs[numConfigs];
eglGetConfigs(m_sharedDisplay, configs, numConfigs, &numConfigs);
if (!numConfigs) {
LOG_ERROR("Failed to retrieve any EGL configs.");
return 0;
}
int alphaChannelRequired = m_attributes & GLPlatformSurface::SupportAlpha ? 8 : 0;
for (i = 0; i < numConfigs; i++) {
EGLint alpha, surfaces;
EGLConfig tempConfig = configs[i];
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_NATIVE_VISUAL_ID, &visualId);
if (static_cast<NativeVisualId>(visualId) != id)
continue;
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_ALPHA_SIZE, &alpha);
if (alphaChannelRequired != alpha)
continue;
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_SURFACE_TYPE, &surfaces);
if (surfaces & EGL_PIXMAP_BIT) {
config = tempConfig;
break;
}
}
return config;
}
示例9: jni_eglGetConfigs
static jboolean jni_eglGetConfigs(JNIEnv *_env, jobject _this, jobject display,
jobjectArray configs, jint config_size, jintArray num_config) {
if (display == NULL || (configs != NULL && _env->GetArrayLength(configs) < config_size)
|| (num_config != NULL && _env->GetArrayLength(num_config) < 1)) {
jniThrowException(_env, "java/lang/IllegalArgumentException", NULL);
return JNI_FALSE;
}
EGLDisplay dpy = getDisplay(_env, display);
jboolean success = JNI_FALSE;
if (configs == NULL) {
config_size = 0;
}
EGLConfig nativeConfigs[config_size];
int num;
success = eglGetConfigs(dpy, configs ? nativeConfigs : 0, config_size, &num);
if (num_config != NULL) {
_env->SetIntArrayRegion(num_config, 0, 1, (jint*) &num);
}
if (success && configs) {
for (int i=0 ; i<num ; i++) {
jobject obj = _env->NewObject(gConfig_class, gConfig_ctorID, (jint)nativeConfigs[i]);
_env->SetObjectArrayElement(configs, i, obj);
}
}
return success;
}
示例10: EglConfigForConfigID
EGLConfig EglConfigForConfigID( const EGLDisplay display, const GLint configID )
{
static const int MAX_CONFIGS = 1024;
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs = 0;
if ( EGL_FALSE == eglGetConfigs( display,
configs, MAX_CONFIGS, &numConfigs ) )
{
WARN( "eglGetConfigs() failed" );
return NULL;
}
for ( int i = 0; i < numConfigs; i++ )
{
EGLint value = 0;
eglGetConfigAttrib( display, configs[i], EGL_CONFIG_ID, &value );
if ( value == configID )
{
return configs[i];
}
}
return NULL;
}
示例11: make_dummy_surface
static gboolean
make_dummy_surface (ClutterBackendWayland *backend_wayland)
{
static const EGLint attrs[] = {
EGL_WIDTH, 1,
EGL_HEIGHT, 1,
EGL_RENDERABLE_TYPE, _COGL_RENDERABLE_BIT,
EGL_NONE };
EGLint num_configs;
eglGetConfigs(backend_wayland->edpy,
&backend_wayland->egl_config, 1, &num_configs);
if (num_configs < 1)
return FALSE;
backend_wayland->egl_surface =
eglCreatePbufferSurface(backend_wayland->edpy,
backend_wayland->egl_config,
attrs);
if (backend_wayland->egl_surface == EGL_NO_SURFACE)
return FALSE;
return TRUE;
}
示例12: initEglOnly
void initEglOnly()
{
const EGLint config_attr[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_NONE
};
EGLint configs, major, minor;
EGLNativeDisplayType native_disp = fbGetDisplayByIndex(0); /* i.MX6 specific */
fbGetDisplayGeometry(native_disp, &m_width, &m_height); /* i.MX6 specific */
EGLNativeWindowType native_win = fbCreateWindow(native_disp, 0, 0, m_width, m_height); /* i.MX6 specific */
eglBindAPI(EGL_OPENGL_ES_API);
m_egldisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(m_egldisplay, &major, &minor);
eglGetConfigs(m_egldisplay, NULL, 0, &configs);
eglChooseConfig(m_egldisplay, config_attr, &m_eglconfig, 1, &configs);
m_eglsurface = eglCreateWindowSurface(m_egldisplay, m_eglconfig, native_win, NULL);
}
示例13: Java_org_lwjgl_opengles_EGL_neglGetConfigs
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong configs, jint config_size, jlong num_config) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig *configs_address = (EGLConfig *)(intptr_t)configs;
EGLint *num_config_address = (EGLint *)(intptr_t)num_config;
return eglGetConfigs(dpy, configs_address, config_size, num_config_address);
}
示例14: EGLInit
EGLInit( IDirectFB_C *dfb,
IDirectFBSurface_C *dfb_surface )
{
EGLint width, height;
EGLint major, minor, nconfigs;
EGLint attribs[] = {
EGL_BUFFER_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, 16,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_RED_SIZE, 5,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
EGLint context_attrs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE
};
EGLint surface_attrs[] = {
EGL_RENDER_BUFFER, EGL_BACK_BUFFER, EGL_NONE
};
EGLint render_buffer = 0;
sleep(4);
// get display
EGL_CHECK((display = eglGetDisplay((EGLNativeDisplayType) dfb)) == EGL_NO_DISPLAY)
// init
EGL_CHECK(!eglInitialize(display, &major, &minor))
// get configs
EGL_CHECK(!eglGetConfigs(display, configs, 2, &nconfigs))
// choose config
EGL_CHECK(!eglChooseConfig(display, attribs, configs, 2, &nconfigs))
// create a surface
EGL_CHECK((surface = eglCreateWindowSurface(display, configs[0], (EGLNativeWindowType) dfb_surface, surface_attrs)) == EGL_NO_SURFACE)
EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API) != EGL_TRUE)
// create context
EGL_CHECK((context = eglCreateContext(display, configs[0], EGL_NO_CONTEXT, context_attrs)) == EGL_NO_CONTEXT)
EGL_CHECK(eglMakeCurrent(display, surface, surface, context) != EGL_TRUE)
eglQuerySurface(display, surface, EGL_WIDTH, &width);
eglQuerySurface(display, surface, EGL_HEIGHT, &height);
EGL_CHECK(!eglQuerySurface(display, surface, EGL_RENDER_BUFFER, &render_buffer));
// fprintf(stderr,"RENDER_BUFFER = 0x%04x\n", render_buffer );
eglSwapInterval( display, 1 );
quit:
return;
}
示例15: CreateEGLContext
EGLBoolean CreateEGLContext(EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
EGLContext* eglContext, EGLSurface* eglSurface,
EGLint* configAttribList, EGLint* surfaceAttribList)
{
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
EGLDisplay display;
EGLContext context;
EGLSurface surface;
EGLConfig config;
EGLint contextAttribs[] =
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE, EGL_NONE
};
// Get display
display = eglGetDisplay(GetDC(hWnd)); // EGL_DEFAULT_DISPLAY
if (display == EGL_NO_DISPLAY)
return EGL_FALSE;
// Initialize EGL
if (!eglInitialize(display, &majorVersion, &minorVersion))
return EGL_FALSE;
// Get configs
if (!eglGetConfigs(display, NULL, 0, &numConfigs))
return EGL_FALSE;
// Choose config
if (!eglChooseConfig(display, configAttribList, &config, 1, &numConfigs))
return EGL_FALSE;
// Create a surface
surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, surfaceAttribList);
if (surface == EGL_NO_SURFACE)
return EGL_FALSE;
// Bind the API
eglBindAPI(EGL_OPENGL_ES_API);
// Create a GL context
context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs);
if (context == EGL_NO_CONTEXT)
return EGL_FALSE;
// Make the context current
if (!eglMakeCurrent(display, surface, surface, context))
return EGL_FALSE;
*eglDisplay = display;
*eglSurface = surface;
*eglContext = context;
return EGL_TRUE;
}