本文整理汇总了C++中eglQueryString函数的典型用法代码示例。如果您正苦于以下问题:C++ eglQueryString函数的具体用法?C++ eglQueryString怎么用?C++ eglQueryString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eglQueryString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void
init(void) {
load("libEGL.so.1");
initX();
eglExtensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (eglExtensions &&
checkExtension("EGL_EXT_platform_x11", eglExtensions)) {
Attributes<EGLint> attribs;
attribs.add(EGL_PLATFORM_X11_SCREEN_EXT, screen);
attribs.add(EGL_NONE);
eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11_EXT, display, attribs);
} else {
eglDisplay = eglGetDisplay((EGLNativeDisplayType)display);
}
if (eglDisplay == EGL_NO_DISPLAY) {
std::cerr << "error: unable to get EGL display\n";
XCloseDisplay(display);
exit(1);
}
EGLint major, minor;
if (!eglInitialize(eglDisplay, &major, &minor)) {
std::cerr << "error: unable to initialize EGL display\n";
XCloseDisplay(display);
exit(1);
}
eglExtensions = eglQueryString(eglDisplay, EGL_EXTENSIONS);
has_EGL_KHR_create_context = checkExtension("EGL_KHR_create_context", eglExtensions);
}
示例2: clutter_backend_wayland_get_features
static ClutterFeatureFlags
clutter_backend_wayland_get_features (ClutterBackend *backend)
{
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
ClutterFeatureFlags flags = 0;
g_assert (backend_wayland->egl_context != NULL);
flags |=
CLUTTER_FEATURE_STAGE_MULTIPLE |
CLUTTER_FEATURE_SWAP_EVENTS |
CLUTTER_FEATURE_SYNC_TO_VBLANK;
CLUTTER_NOTE (BACKEND, "Checking features\n"
"GL_VENDOR: %s\n"
"GL_RENDERER: %s\n"
"GL_VERSION: %s\n"
"EGL_VENDOR: %s\n"
"EGL_VERSION: %s\n"
"EGL_EXTENSIONS: %s\n",
glGetString (GL_VENDOR),
glGetString (GL_RENDERER),
glGetString (GL_VERSION),
eglQueryString (backend_wayland->edpy, EGL_VENDOR),
eglQueryString (backend_wayland->edpy, EGL_VERSION),
eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS));
return flags;
}
示例3: info
static void
info(EGLDisplay egl_dpy)
{
const char *s;
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION: %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR: %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS:\n", s);
print_extension_list((char *) s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS: %s\n", s);
const char *glGetString (int name);
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_EXTENSIONS:\n");
print_extension_list((char *) glGetString(GL_EXTENSIONS));
}
示例4: init_egl
static int init_egl(void)
{
EGLint major, minor, n;
GLint ret;
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 0,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
gl.display = eglGetDisplay(gbm.dev);
if (!eglInitialize(gl.display, &major, &minor)) {
printf("failed to initialize\n");
return -1;
}
printf("Using display %p with EGL version %d.%d\n",
gl.display, major, minor);
printf("EGL Version \"%s\"\n", eglQueryString(gl.display, EGL_VERSION));
printf("EGL Vendor \"%s\"\n", eglQueryString(gl.display, EGL_VENDOR));
printf("EGL Extensions \"%s\"\n", eglQueryString(gl.display, EGL_EXTENSIONS));
if (!eglBindAPI(EGL_OPENGL_API)) {
printf("failed to bind api EGL_OPENGL_API\n");
return -1;
}
if (!eglChooseConfig(gl.display, config_attribs, &gl.config, 1, &n) || n != 1) {
printf("failed to choose config: %d\n", n);
return -1;
}
gl.context = eglCreateContext(gl.display, gl.config, EGL_NO_CONTEXT, NULL);
if (gl.context == NULL) {
printf("failed to create context\n");
return -1;
}
gl.surface = eglCreateWindowSurface(gl.display, gl.config, gbm.surface, NULL);
if (gl.surface == EGL_NO_SURFACE) {
printf("failed to create egl surface\n");
return -1;
}
/* connect the context to the surface */
eglMakeCurrent(gl.display, gl.surface, gl.surface, gl.context);
return 0;
}
示例5: Egl_Initialize
EGLDisplay Egl_Initialize()
{
// Get the EGL display (fb0)
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY)
{
printf("eglGetDisplay failed.\n");
exit(1);
}
// Initialize EGL
EGLint major;
EGLint minor;
EGLBoolean success = eglInitialize(display, &major, &minor);
if (success != EGL_TRUE)
{
Egl_CheckError();
}
printf("EGL: major=%d, minor=%d\n", major, minor);
printf("EGL: Vendor=%s\n", eglQueryString(display, EGL_VENDOR));
printf("EGL: Version=%s\n", eglQueryString(display, EGL_VERSION));
printf("EGL: ClientAPIs=%s\n", eglQueryString(display, EGL_CLIENT_APIS));
printf("EGL: Extensions=%s\n", eglQueryString(display, EGL_EXTENSIONS));
printf("EGL: ClientExtensions=%s\n", eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
printf("\n");
return display;
}
示例6: eglutInit
void
eglutInit(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0)
_eglut->display_name = argv[++i];
else if (strcmp(argv[i], "-info") == 0) {
_eglut->verbose = 1;
}
}
_eglutNativeInitDisplay();
_eglut->dpy = eglGetDisplay(_eglut->native_dpy);
if (!eglInitialize(_eglut->dpy, &_eglut->major, &_eglut->minor))
_eglutFatal("failed to initialize EGL display");
_eglut->init_time = _eglutNow();
printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION));
if (_eglut->verbose) {
printf("EGL_VENDOR = %s\n", eglQueryString(_eglut->dpy, EGL_VENDOR));
printf("EGL_EXTENSIONS = %s\n",
eglQueryString(_eglut->dpy, EGL_EXTENSIONS));
printf("EGL_CLIENT_APIS = %s\n",
eglQueryString(_eglut->dpy, EGL_CLIENT_APIS));
}
}
示例7: clutter_backend_egl_get_features
static ClutterFeatureFlags
clutter_backend_egl_get_features (ClutterBackend *backend)
{
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
ClutterFeatureFlags flags;
flags = clutter_backend_x11_get_features (backend);
flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
CLUTTER_NOTE (BACKEND, "Checking features\n"
"GL_VENDOR: %s\n"
"GL_RENDERER: %s\n"
"GL_VERSION: %s\n"
"EGL_VENDOR: %s\n"
"EGL_VERSION: %s\n"
"EGL_EXTENSIONS: %s\n",
glGetString (GL_VENDOR),
glGetString (GL_RENDERER),
glGetString (GL_VERSION),
eglQueryString (backend_egl->edpy, EGL_VENDOR),
eglQueryString (backend_egl->edpy, EGL_VERSION),
eglQueryString (backend_egl->edpy, EGL_EXTENSIONS));
return flags;
}
示例8: x11_display_init
static void x11_display_init(struct display *d)
{
static const EGLint conf_att[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 0,
EGL_NONE,
};
static const EGLint ctx_att[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLBoolean b;
EGLenum api;
EGLint major, minor, n;
d->x11.dpy = XOpenDisplay(NULL);
if (!d->x11.dpy)
error(1, errno, "Unable to open X server display");
d->x11.egl_display = eglGetDisplay((EGLNativeDisplayType)d->x11.dpy);
if (d->x11.egl_display == EGL_NO_DISPLAY)
error(1, errno, "Failed to get EGL display");
if (!eglInitialize(d->x11.egl_display, &major, &minor))
error(1, errno, "Failed to init EGL display");
fprintf(stderr, "EGL major/minor: %d.%d\n", major, minor);
fprintf(stderr, "EGL version: %s\n",
eglQueryString(d->x11.egl_display, EGL_VERSION));
fprintf(stderr, "EGL vendor: %s\n",
eglQueryString(d->x11.egl_display, EGL_VENDOR));
fprintf(stderr, "EGL extensions: %s\n",
eglQueryString(d->x11.egl_display, EGL_EXTENSIONS));
api = EGL_OPENGL_ES_API;
b = eglBindAPI(api);
if (!b)
error(1, errno, "cannot bind OpenGLES API");
b = eglChooseConfig(d->x11.egl_display, conf_att, &d->x11.egl_conf,
1, &n);
if (!b || n != 1)
error(1, errno, "cannot find suitable EGL config");
d->x11.egl_ctx = eglCreateContext(d->x11.egl_display,
d->x11.egl_conf,
EGL_NO_CONTEXT,
ctx_att);
if (!d->x11.egl_ctx)
error(1, errno, "cannot create EGL context");
eglMakeCurrent(d->x11.egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
}
示例9: main
int
main (int argc, char *argv[])
{
EGLint config_cc;
EGLint cc;
EGLConfig config[100];
EGLDisplay edpy = EGL_NO_DISPLAY;
griCtlErrorCommit (GRI_ERROR_CRIT_ATTR);
/*
* * Запрос устройства по-умолчанию
* */
edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY);
if (edpy == EGL_NO_DISPLAY)
griError ("EGL_GET_DISPLAY_FAIL");
/*
* * Инициализация устройства
* */
if (eglInitialize (edpy, NULL, NULL) == EGL_FALSE)
{
griError ("EGL_INIT_FAIL");
}
/*
* * Распечатка версии EGL, поставщика и доступных API
* */
printf ("EGL Version: %s\n", eglQueryString (edpy, EGL_VERSION));
printf ("EGL Vendor: %s\n", eglQueryString (edpy, EGL_VENDOR));
printf ("EGL APIs: %s\n", eglQueryString (edpy, EGL_CLIENT_APIS));
/*
* * Запрос подходящей конфигурации, подходящей под атрибуты egl_attribs
* * EGLDisplay dpy : указатель на интересующее устройство
* * EGLConfig *config : указатель на массив возвращаемых конфигов
* * EGLint config_size : максимальное количество возможных элементов
* * в *config
* * EGLint *num_config : количество возвращённых (в *config) конфигураций
* */
if (eglGetConfigs (edpy, config, 100, &config_cc)
== EGL_FALSE)
griError ("EGL_CHOOSE_CONFIG_FAIL");
if (!config_cc)
griError ("EGL_NO_CONFIG_AVAILABLE");
cc = config_cc;
printf ("# count: %d\n", config_cc);
while (cc--)
{
printf ("# EGLConfig: %d/%d\n", cc, config_cc);
print_eglConfig (edpy, config[cc]);
}
printf ("@ END\n");
return 0;
}
示例10: gdk_wayland_display_init_gl
gboolean
gdk_wayland_display_init_gl (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
EGLint major, minor;
EGLDisplay *dpy;
if (display_wayland->have_egl)
return TRUE;
dpy = eglGetDisplay ((EGLNativeDisplayType)display_wayland->wl_display);
if (dpy == NULL)
return FALSE;
if (!eglInitialize (dpy, &major, &minor))
return FALSE;
if (!eglBindAPI (EGL_OPENGL_API))
return FALSE;
display_wayland->egl_display = dpy;
display_wayland->egl_major_version = major;
display_wayland->egl_minor_version = minor;
display_wayland->have_egl = TRUE;
display_wayland->have_egl_khr_create_context =
epoxy_has_egl_extension (dpy, "EGL_KHR_create_context");
display_wayland->have_egl_buffer_age =
epoxy_has_egl_extension (dpy, "EGL_EXT_buffer_age");
display_wayland->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage");
display_wayland->have_egl_surfaceless_context =
epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context");
GDK_NOTE (OPENGL,
g_print ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n"
,
display_wayland->egl_major_version,
display_wayland->egl_minor_version,
eglQueryString (dpy, EGL_VENDOR),
eglQueryString(dpy, EGL_VERSION),
eglQueryString(dpy, EGL_CLIENT_APIS),
eglQueryString(dpy, EGL_EXTENSIONS)));
return TRUE;
}
示例11: _gdk_mir_display_init_egl_display
gboolean
_gdk_mir_display_init_egl_display (GdkDisplay *display)
{
GdkMirDisplay *mir_dpy = GDK_MIR_DISPLAY (display);
EGLint major_version, minor_version;
EGLDisplay *dpy;
if (mir_dpy->egl_display)
return TRUE;
dpy = eglGetDisplay (mir_connection_get_egl_native_display (mir_dpy->connection));
if (dpy == NULL)
return FALSE;
if (!eglInitialize (dpy, &major_version, &minor_version))
return FALSE;
if (!eglBindAPI (EGL_OPENGL_API))
return FALSE;
mir_dpy->egl_display = dpy;
mir_dpy->have_egl_khr_create_context =
epoxy_has_egl_extension (dpy, "EGL_KHR_create_context");
mir_dpy->have_egl_buffer_age =
epoxy_has_egl_extension (dpy, "EGL_EXT_buffer_age");
mir_dpy->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage");
mir_dpy->have_egl_surfaceless_context =
epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context");
GDK_NOTE (OPENGL,
g_print ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n",
major_version,
minor_version,
eglQueryString (dpy, EGL_VENDOR),
eglQueryString (dpy, EGL_VERSION),
eglQueryString (dpy, EGL_CLIENT_APIS),
eglQueryString (dpy, EGL_EXTENSIONS)));
return TRUE;
}
示例12: test_caps
void test_caps(void)
{
GLint width, height;
EGLint pbuffer_attribute_list[] = {
EGL_WIDTH, 256,
EGL_HEIGHT, 256,
EGL_LARGEST_PBUFFER, EGL_TRUE,
EGL_NONE
};
EGLSurface surface;
int i;
RD_START("caps", "");
ECHK(surface = eglCreatePbufferSurface(display, config, pbuffer_attribute_list));
ECHK(eglQuerySurface(display, surface, EGL_WIDTH, &width));
ECHK(eglQuerySurface(display, surface, EGL_HEIGHT, &height));
DEBUG_MSG("PBuffer: %dx%d", width, height);
/* connect the context to the surface */
ECHK(eglMakeCurrent(display, surface, surface, context));
GCHK(glFlush());
printf("EGL Version %s\n", eglQueryString(display, EGL_VERSION));
printf("EGL Vendor %s\n", eglQueryString(display, EGL_VENDOR));
printf("EGL Extensions %s\n", eglQueryString(display, EGL_EXTENSIONS));
printf("GL Version %s\n", glGetString(GL_VERSION));
printf("GL extensions: %s\n", glGetString(GL_EXTENSIONS));
for (i = 0; i < ARRAY_SIZE(int_params); i++) {
GLint val[4] = {};
GLenum err;
glGetIntegerv(int_params[i].pname, val);
err = glGetError();
if (err != GL_NO_ERROR) {
printf("no %s: %s\n", int_params[i].name, glStrError(err));
} else {
printf("%s: %d %d %d %d\n", int_params[i].name,
val[0], val[1], val[2], val[3]);
}
}
RD_END();
}
示例13: Q_D
void QGLContext::makeCurrent()
{
Q_D(QGLContext);
if (!d->valid || !d->eglContext || d->eglSurfaceForDevice() == EGL_NO_SURFACE) {
qWarning("QGLContext::makeCurrent(): Cannot make invalid context current");
return;
}
if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) {
QGLContextPrivate::setCurrentContext(this);
if (!d->workaroundsCached) {
d->workaroundsCached = true;
const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
if (renderer && (strstr(renderer, "SGX") || strstr(renderer, "MBX"))) {
// PowerVR MBX/SGX chips needs to clear all buffers when starting to render
// a new frame, otherwise there will be a performance penalty to pay for
// each frame.
d->workaround_needsFullClearOnEveryFrame = true;
// Older PowerVR SGX drivers (like the one in the N900) have a
// bug which prevents glCopyTexSubImage2D() to work with a POT
// or GL_ALPHA texture bound to an FBO. The only way to
// identify that driver is to check the EGL version number for it.
const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION);
if (egl_version && strstr(egl_version, "1.3"))
d->workaround_brokenFBOReadBack = true;
}
}
}
}
示例14: PVRShellIsExtensionSupported
// The recommended technique for querying OpenGL extensions;
// adapted from http://opengl.org/resources/features/OGLextensions/
static bool PVRShellIsExtensionSupported(EGLDisplay dpy, const char *extension)
{
const char *extensions = NULL;
const char *start;
char *where, *terminator;
/* Extension names should not have spaces. */
where = (char *) strchr(extension, ' ');
if (where || *extension == '\0')
return false;
extensions = eglQueryString(dpy, EGL_EXTENSIONS);
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings, etc. */
start = extensions;
for (;;)
{
where = (char *) strstr((const char *) start, extension);
if (!where)
break;
terminator = where + strlen(extension);
if (where == start || *(where - 1) == ' ')
if (*terminator == ' ' || *terminator == '\0')
return true;
start = terminator;
}
return false;
}
示例15: check_egl_extensions
/* Updates all the function pointers */
static void
check_egl_extensions(cg_renderer_t *renderer)
{
cg_renderer_egl_t *egl_renderer = renderer->winsys;
const char *egl_extensions;
char **split_extensions;
int i;
egl_extensions = eglQueryString(egl_renderer->edpy, EGL_EXTENSIONS);
split_extensions = c_strsplit(egl_extensions, " ", 0 /* max_tokens */);
CG_NOTE(WINSYS, " EGL Extensions: %s", egl_extensions);
egl_renderer->private_features = 0;
for (i = 0; i < C_N_ELEMENTS(winsys_feature_data); i++)
if (_cg_feature_check(renderer,
"EGL",
winsys_feature_data + i,
0,
0,
CG_DRIVER_GL, /* the driver isn't used */
split_extensions,
egl_renderer)) {
egl_renderer->private_features |=
winsys_feature_data[i].feature_flags_private;
}
c_strfreev(split_extensions);
}