本文整理汇总了C++中eglCreatePbufferSurface函数的典型用法代码示例。如果您正苦于以下问题:C++ eglCreatePbufferSurface函数的具体用法?C++ eglCreatePbufferSurface怎么用?C++ eglCreatePbufferSurface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eglCreatePbufferSurface函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: eglCreatePbufferSurface
bool EGLPlatform::initSurface()
{
// create the surface
#if USE_PBUFFER
EGLint attribs[] = {
EGL_WIDTH, width,
EGL_HEIGHT, height,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
this->surface = eglCreatePbufferSurface(this->display, this->config, attribs);
#elif USE_PIXMAP
EGLint attribs[] = {EGL_NONE};
this->surface = eglCreatePixmapSurface(this->display, this->config, this->pixmap, attribs);
#else
EGLint attribs[] = {EGL_NONE};
this->surface = eglCreateWindowSurface(this->display, this->config, this->window, NULL);
#endif
if(this->surface == EGL_NO_SURFACE)
{
printf("Error: EGL surface creation failed (error code: 0x%x)\n", eglGetError());
return false;
}
return true;
}
开发者ID:Plombo,项目名称:micropolis,代码行数:27,代码来源:eglplatform.cpp
示例2: m_display
EglContext::EglContext(EglContext* shared) :
m_display (EGL_NO_DISPLAY),
m_context (EGL_NO_CONTEXT),
m_surface (EGL_NO_SURFACE),
m_config (NULL)
{
// Get the initialized EGL display
m_display = getInitializedDisplay();
// Get the best EGL config matching the default video settings
m_config = getBestConfig(m_display, VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());
updateSettings();
// Note: The EGL specs say that attrib_list can be NULL when passed to eglCreatePbufferSurface,
// but this is resulting in a segfault. Bug in Android?
EGLint attrib_list[] = {
EGL_WIDTH, 1,
EGL_HEIGHT,1,
EGL_NONE
};
m_surface = eglCheck(eglCreatePbufferSurface(m_display, m_config, attrib_list));
// Create EGL context
createContext(shared);
}
开发者ID:CastBart,项目名称:AndroidTesting,代码行数:26,代码来源:EglContext.cpp
示例3: eglCreatePbufferSurface
EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGLConfig& config, EGLint* errorCode)
{
const EGLint attribList[] = {
EGL_WIDTH, size.width(),
EGL_HEIGHT, size.height(),
EGL_NONE
};
EGLSurface surface = eglCreatePbufferSurface(m_display, config, attribList);
if (errorCode)
*errorCode = eglGetError();
else
ASSERT_EGL_NO_ERROR();
if (surface == EGL_NO_SURFACE)
return EGL_NO_SURFACE;
EGLint surfaceConfigId;
EGLBoolean success = eglGetConfigAttrib(m_display, config, EGL_CONFIG_ID, &surfaceConfigId);
ASSERT(success == EGL_TRUE);
ASSERT(surfaceConfigId != EGL_BAD_ATTRIBUTE);
ASSERT(!m_surfaceConfigIds.contains(surface));
m_surfaceConfigIds.set(surface, surfaceConfigId);
return surface;
}
开发者ID:1833183060,项目名称:wke,代码行数:26,代码来源:EGLDisplayOpenVG.cpp
示例4: eglDestroySurface
bool GlesBox::createSurface(uint32_t width, uint32_t height, uint64_t native_windows_id) {
if (core_->surface_ != nullptr) {
eglDestroySurface(core_->surface_, core_->surface_);
core_->surface_ = nullptr;
}
// Create a surface
core_->width_ = width;
core_->height_ = height;
EGLint PBufAttribs[] = {
EGL_WIDTH, (EGLint)core_->width_,
EGL_HEIGHT, (EGLint)core_->height_,
EGL_LARGEST_PBUFFER, EGL_TRUE,
EGL_NONE
};
if (native_windows_id != 0) {//attach on native windows
EGLNativeWindowType handle = reinterpret_cast<EGLNativeWindowType>(native_windows_id);
core_->surface_ = eglCreateWindowSurface(core_->display_, core_->config_, handle, NULL);
}
else // off-render
core_->surface_ = eglCreatePbufferSurface(core_->display_, core_->config_, PBufAttribs);
if (core_->surface_ == EGL_NO_SURFACE) {
LOGE("eglCreateWindowSurface fail: %d.", eglGetError());
return false;
}
return true;
}
开发者ID:buffer8848,项目名称:glesbox,代码行数:29,代码来源:glesbox.cpp
示例5: Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreatePbufferSurface(dpy, config, attrib_list_address);
}
开发者ID:einspunktnull,项目名称:lwjgl,代码行数:7,代码来源:org_lwjgl_opengles_EGL.c
示例6: make_pbuffer
static void
make_pbuffer(int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE,
EGL_NONE
};
EGLint pbuf_attribs[] = {
EGL_WIDTH, width,
EGL_HEIGHT, height,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
EGLConfig config;
EGLint num_configs;
if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs) ||
!num_configs) {
printf("Error: couldn't get an EGL visual config for pbuffer\n");
exit(1);
}
ctx_pbuf = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL );
surf_pbuf = eglCreatePbufferSurface(dpy, config, pbuf_attribs);
if (surf_pbuf == EGL_NO_SURFACE) {
printf("failed to allocate pbuffer\n");
exit(1);
}
}
开发者ID:Distrotech,项目名称:mesa-demos,代码行数:33,代码来源:bindtex.c
示例7: 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;
}
开发者ID:nobled,项目名称:clutter,代码行数:25,代码来源:clutter-backend-wayland.c
示例8: fromEGLHandle
/* EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) */
static jobject
android_eglCreatePbufferSurface
(JNIEnv *_env, jobject _this, jobject dpy, jobject config, jintArray attrib_list_ref, jint offset) {
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
EGLSurface _returnValue = (EGLSurface) 0;
EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
bool attrib_list_sentinel = false;
EGLint *attrib_list_base = (EGLint *) 0;
jint _remaining;
EGLint *attrib_list = (EGLint *) 0;
if (!attrib_list_ref) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "attrib_list == null";
goto exit;
}
if (offset < 0) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "offset < 0";
goto exit;
}
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
_env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = false;
for (int i = _remaining - 1; i >= 0; i--) {
if (attrib_list[i] == EGL_NONE){
attrib_list_sentinel = true;
break;
}
}
if (attrib_list_sentinel == false) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "attrib_list must contain EGL_NONE!";
goto exit;
}
_returnValue = eglCreatePbufferSurface(
(EGLDisplay)dpy_native,
(EGLConfig)config_native,
(EGLint *)attrib_list
);
exit:
if (attrib_list_base) {
_env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
}
return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
}
开发者ID:shashlik,项目名称:old-gentroid-frameworks-base,代码行数:61,代码来源:android_opengl_EGL14.cpp
示例9: fContext
SkANGLEGLContext::SkANGLEGLContext()
: fContext(EGL_NO_CONTEXT)
, fDisplay(EGL_NO_DISPLAY)
, fSurface(EGL_NO_SURFACE) {
EGLint numConfigs;
static const EGLint configAttribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_NONE
};
fDisplay = GetD3DEGLDisplay(EGL_DEFAULT_DISPLAY);
if (EGL_NO_DISPLAY == fDisplay) {
SkDebugf("Could not create EGL display!");
return;
}
EGLint majorVersion;
EGLint minorVersion;
eglInitialize(fDisplay, &majorVersion, &minorVersion);
EGLConfig surfaceConfig;
eglChooseConfig(fDisplay, configAttribs, &surfaceConfig, 1, &numConfigs);
static const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
fContext = eglCreateContext(fDisplay, surfaceConfig, NULL, contextAttribs);
static const EGLint surfaceAttribs[] = {
EGL_WIDTH, 1,
EGL_HEIGHT, 1,
EGL_NONE
};
fSurface = eglCreatePbufferSurface(fDisplay, surfaceConfig, surfaceAttribs);
eglMakeCurrent(fDisplay, fSurface, fSurface, fContext);
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateANGLEInterface());
if (NULL == gl.get()) {
SkDebugf("Could not create ANGLE GL interface!\n");
this->destroyGLContext();
return;
}
if (!gl->validate()) {
SkDebugf("Could not validate ANGLE GL interface!\n");
this->destroyGLContext();
return;
}
this->init(gl.detach());
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:60,代码来源:SkANGLEGLContext.cpp
示例10: main
int main(int argc, char *argv[])
{
GLint width, height;
EGLint pbuffer_attribute_list[] = {
EGL_WIDTH, 256,
EGL_HEIGHT, 256,
EGL_LARGEST_PBUFFER, EGL_TRUE,
EGL_NONE
};
const EGLint config_attribute_list[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_DEPTH_SIZE, 8,
EGL_NONE
};
const EGLint context_attribute_list[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLDisplay display;
EGLConfig config;
EGLint num_config;
EGLContext context;
EGLSurface surface;
int i;
display = get_display();
/* get an appropriate EGL frame buffer configuration */
ECHK(eglChooseConfig(display, config_attribute_list, &config, 1, &num_config));
DEBUG_MSG("num_config: %d", num_config);
/* create an EGL rendering context */
ECHK(context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attribute_list));
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());
for (i = 0; ; i++) {
if (test_compiler(i)) {
break;
}
}
ECHK(eglDestroySurface(display, surface));
ECHK(eglTerminate(display));
}
开发者ID:Dm47021,项目名称:freedreno-1,代码行数:57,代码来源:test-compiler.c
示例11: eglSetup
/*
* Sets up EGL. Creates a 1280x720 pbuffer, which is large enough to
* cause a rapid and highly visible memory leak if we fail to discard it.
*/
bool eglSetup() {
static const EGLint kConfigAttribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_NONE
};
static const EGLint kContextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
static const EGLint kPbufferAttribs[] = {
EGL_WIDTH, 1280,
EGL_HEIGHT, 720,
EGL_NONE
};
//usleep(25000);
mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (mEglDisplay == EGL_NO_DISPLAY) {
ALOGW("eglGetDisplay failed: 0x%x", eglGetError());
return false;
}
EGLint majorVersion, minorVersion;
if (!eglInitialize(mEglDisplay, &majorVersion, &minorVersion)) {
ALOGW("eglInitialize failed: 0x%x", eglGetError());
return false;
}
EGLConfig eglConfig;
EGLint numConfigs = 0;
if (!eglChooseConfig(mEglDisplay, kConfigAttribs, &eglConfig,
1, &numConfigs)) {
ALOGW("eglChooseConfig failed: 0x%x", eglGetError());
return false;
}
mEglSurface = eglCreatePbufferSurface(mEglDisplay, eglConfig,
kPbufferAttribs);
if (mEglSurface == EGL_NO_SURFACE) {
ALOGW("eglCreatePbufferSurface failed: 0x%x", eglGetError());
return false;
}
mEglContext = eglCreateContext(mEglDisplay, eglConfig, EGL_NO_CONTEXT,
kContextAttribs);
if (mEglContext == EGL_NO_CONTEXT) {
ALOGW("eglCreateContext failed: 0x%x", eglGetError());
return false;
}
return true;
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:61,代码来源:EGLCleanup_test.cpp
示例12: LOG_ALWAYS_FATAL_IF
void EglManager::createPBufferSurface() {
LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY,
"usePBufferSurface() called on uninitialized GlobalContext!");
if (mPBufferSurface == EGL_NO_SURFACE) {
EGLint attribs[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE};
mPBufferSurface = eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs);
}
}
开发者ID:AlanCheen,项目名称:platform_frameworks_base,代码行数:9,代码来源:EglManager.cpp
示例13: PthreadMain
void * PthreadMain (void * param)
{
Logger::Info("[PthreadMain] param = %p", param);
Thread * t = (Thread*)param;
if(t->needCopyContext)
{
EGLConfig localConfig;
bool ret = GetConfig(Thread::currentDisplay, localConfig);
Logger::Info("[PthreadMain] GetConfig returned = %d", ret);
if(ret)
{
EGLint contextAttrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
t->localContext = eglCreateContext(t->currentDisplay, localConfig, t->currentContext, contextAttrs);
// t->localContext = eglCreateContext(t->currentDisplay, localConfig, EGL_NO_CONTEXT, contextAttrs);
}
if(t->localContext == EGL_NO_CONTEXT)
{
Logger::Error("[PthreadMain] Can't create local context");
}
GLint surfAttribs[] =
{
EGL_HEIGHT, 768,
EGL_WIDTH, 1024,
EGL_NONE
};
EGLSurface readSurface = eglCreatePbufferSurface(t->currentDisplay, localConfig, surfAttribs);
// EGLSurface drawSurface = eglCreatePbufferSurface(t->currentDisplay, localConfig, surfAttribs);
//TODO: set context
// bool ret2 = eglMakeCurrent(t->currentDisplay, t->currentDrawSurface, t->currentReadSurface, t->localContext);
bool ret2 = eglMakeCurrent(t->currentDisplay, readSurface, readSurface, t->localContext);
Logger::Info("[PthreadMain] set eglMakeCurrent returned = %d", ret2);
}
t->state = Thread::STATE_RUNNING;
t->msg(t);
if(t->needCopyContext)
{
//TODO: Restore context
bool ret = eglMakeCurrent(t->currentDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
Logger::Info("[PthreadMain] restore eglMakeCurrent returned = %d", ret);
}
t->state = Thread::STATE_ENDED;
t->Release();
pthread_exit(0);
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:56,代码来源:ThreadAndroid.cpp
示例14: egl_manager_create_pbuffer
static EGLBoolean
egl_manager_create_pbuffer(struct egl_manager *eman, const EGLint *attrib_list)
{
eman->pbuf = eglCreatePbufferSurface(eman->dpy, eman->conf, attrib_list);
if (eman->pbuf == EGL_NO_SURFACE) {
printf("eglCreatePbufferSurface() failed\n");
return EGL_FALSE;
}
return EGL_TRUE;
}
开发者ID:aosm,项目名称:X11apps,代码行数:11,代码来源:xeglgears.c
示例15: halide_opengl_create_context
WEAK int halide_opengl_create_context(void *user_context) {
if (eglGetCurrentContext() != EGL_NO_CONTEXT)
return 0;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY || !eglInitialize(display, 0, 0)) {
error(user_context) << "Could not initialize EGL display: " << eglGetError();
return 1;
}
EGLint attribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_NONE,
};
EGLConfig config;
int numconfig;
eglChooseConfig(display, attribs, &config, 1, &numconfig);
if (numconfig != 1) {
error(user_context) << "eglChooseConfig(): config not found: "
<< eglGetError() << " - " << numconfig;
return -1;
}
EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLContext context = eglCreateContext(display, config, EGL_NO_CONTEXT,
context_attribs);
if (context == EGL_NO_CONTEXT) {
error(user_context) << "Error: eglCreateContext failed: " << eglGetError();
return -1;
}
EGLint surface_attribs[] = {
EGL_WIDTH, 1,
EGL_HEIGHT, 1,
EGL_NONE
};
EGLSurface surface = eglCreatePbufferSurface(display, config, surface_attribs);
if (surface == EGL_NO_SURFACE) {
error(user_context) << "Error: Could not create EGL window surface: " << eglGetError();
return -1;
}
eglMakeCurrent(display, surface, surface, context);
return 0;
}
开发者ID:DoDNet,项目名称:Halide,代码行数:53,代码来源:android_opengl_context.cpp
示例16: egl_init
static EGLBoolean egl_init(EGLmanager *eglman)
{
EGLint pbuffer_attrib[] =
{
EGL_WIDTH, 128,
EGL_HEIGHT, 128,
EGL_NONE
};
// Check extension support
if (check_ext(eglman) != EGL_TRUE)
{
return EGL_FALSE;
}
// Create GL context
eglBindAPI(EGL_OPENGL_ES_API);
eglman->es_ctx = eglCreateContext(eglman->dpy, eglman->conf, NULL, NULL);
if (eglman->es_ctx == EGL_NO_CONTEXT ||
eglGetError() != EGL_SUCCESS)
{
return EGL_FALSE;
}
// Create VG context
eglBindAPI(EGL_OPENVG_API);
eglman->vg_ctx = eglCreateContext(eglman->dpy, eglman->conf, NULL, NULL);
if (eglman->vg_ctx == EGL_NO_CONTEXT ||
eglGetError() != EGL_SUCCESS)
{
return EGL_FALSE;
}
// Create window surface
eglman->win_surface = eglCreateWindowSurface(eglman->dpy, eglman->conf, eglman->xwin, NULL);
if (eglman->win_surface == EGL_NO_SURFACE ||
eglGetError() != EGL_SUCCESS)
{
return EGL_FALSE;
}
// Create pbuffer surface
eglman->pbuf_surface = eglCreatePbufferSurface(eglman->dpy, eglman->conf, pbuffer_attrib);
if (eglman->pbuf_surface == EGL_NO_SURFACE ||
eglGetError() != EGL_SUCCESS)
{
return EGL_FALSE;
}
return EGL_TRUE;
}
开发者ID:eviom,项目名称:mesademos,代码行数:52,代码来源:tex2vgimage.c
示例17: eglCreatePbufferSurface
void GLHelper::CreatePBufferSurfaceAndMakeCurrent()
{
// create pbuffer surface, this allows us to upload resources and then switch to an
// eglwindowsurface when the java Surface is ready
EGLint pbufferAttribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE };
_eglPBufferSurface = eglCreatePbufferSurface(_eglDisplay, _eglPBufferConfig, pbufferAttribs);
if (_eglPBufferSurface == EGL_FALSE)
{
Xli::Error->WriteLine((Xli::String)"Unable to make EGL pbuffer surface");
XLI_THROW("Unable to make EGL pbuffer surface");
}
MakeCurrent(_eglPBufferContext, _eglPBufferSurface);
}
开发者ID:kstv,项目名称:BlackCode-Fuse,代码行数:14,代码来源:GLHelper.cpp
示例18: main
int main(void)
{
EGLDisplay display;
EGLContext context;
EGLConfig config;
EGLSurface surface;
EGLBoolean result;
EGLint num_config;
static const EGLint attribute_list[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
result = eglInitialize(display, NULL, NULL);
assert(result != EGL_FALSE);
eglBindAPI(EGL_OPENVG_API);
result = eglChooseConfig(display, attribute_list, &config, 1, &num_config);
assert(result != EGL_FALSE);
context = eglCreateContext(display, config, NULL, NULL);
assert(context != EGL_NO_CONTEXT);
surface = eglCreatePbufferSurface(display, config, NULL);
eglMakeCurrent(display, surface, surface, context);
display_info("Vendor", VG_VENDOR);
display_info("Renderer", VG_RENDERER);
display_info("Version", VG_VERSION);
display_info("Extensions", VG_EXTENSIONS);
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(display, context);
eglTerminate(display);
eglReleaseThread();
return 0;
}
开发者ID:shirro,项目名称:gpustuff,代码行数:50,代码来源:vginfo.c
示例19: jni_eglCreatePbufferSurface
static jint jni_eglCreatePbufferSurface(JNIEnv *_env, jobject _this, jobject display,
jobject config, jintArray attrib_list) {
if (display == NULL || config == NULL
|| !validAttribList(_env, attrib_list)) {
jniThrowException(_env, "java/lang/IllegalArgumentException", NULL);
return JNI_FALSE;
}
EGLDisplay dpy = getDisplay(_env, display);
EGLConfig cnf = getConfig(_env, config);
jint* base = beginNativeAttribList(_env, attrib_list);
EGLSurface sur = eglCreatePbufferSurface(dpy, cnf, base);
endNativeAttributeList(_env, attrib_list, base);
return (jint)sur;
}
开发者ID:10x-Amin,项目名称:frameworks_base,代码行数:14,代码来源:com_google_android_gles_jni_EGLImpl.cpp
示例20: test_create_pbuffer
/* Test that eglCreatePbufferSurface succeeds if given an EGLConfig with
* EGL_PBUFFER_BIT.
*
* From the EGL_MESA_platform_surfaceless spec (v1):
*
* The surfaceless platform imposes no platform-specific restrictions on the
* creation of pbuffers, as eglCreatePbufferSurface has no native surface
* parameter. [...] Specifically, if the EGLDisplay advertises an EGLConfig
* whose EGL_SURFACE_TYPE attribute contains EGL_PBUFFER_BIT, then the
* EGLDisplay permits the creation of pbuffers.
*/
static enum piglit_result
test_create_pbuffer(void *test_data)
{
EGLDisplay dpy = EGL_NO_DISPLAY;
EGLConfig config = EGL_NO_CONFIG_KHR;
EGLint num_configs = 9999;
EGLSurface surf;
const EGLint config_attrs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RED_SIZE, EGL_DONT_CARE,
EGL_GREEN_SIZE, EGL_DONT_CARE,
EGL_BLUE_SIZE, EGL_DONT_CARE,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
/* This is a bitmask that selects the rendering API (such as
* EGL_OPENGL_BIT and EGL_OPENGL_ES2_BIT). Accept any API,
* because we don't care.
*/
EGL_RENDERABLE_TYPE, ~0,
EGL_NONE,
};
test_setup(&dpy);
if (!eglChooseConfig(dpy, config_attrs, &config, 1, &num_configs)) {
printf("eglChooseConfig failed\n");
return PIGLIT_FAIL;
}
if (num_configs == 0) {
printf("found no EGLConfig with EGL_PBUFFER_BIT... skip\n");
return PIGLIT_SKIP;
}
surf = eglCreatePbufferSurface(dpy, config, /*attribs*/ NULL);
if (!surf) {
printf("eglCreatePbufferSurface failed\n");
return PIGLIT_FAIL;
}
eglDestroySurface(dpy, surf);
eglTerminate(dpy);
return PIGLIT_PASS;
}
开发者ID:dumbbell,项目名称:piglit,代码行数:60,代码来源:egl_mesa_platform_surfaceless.c
注:本文中的eglCreatePbufferSurface函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论