• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ eglGetCurrentContext函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中eglGetCurrentContext函数的典型用法代码示例。如果您正苦于以下问题:C++ eglGetCurrentContext函数的具体用法?C++ eglGetCurrentContext怎么用?C++ eglGetCurrentContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了eglGetCurrentContext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: worldofgoo_CallBooleanMethodV

jboolean
worldofgoo_CallBooleanMethodV(JNIEnv* p0, jobject p1, jmethodID p2, va_list p3)
{
    printf("worldofgoo_CallBooleanMethodV(%s)\n", p2->name);
    if (strcmp(p2->name, "isGlThread") == 0) {
        printf("isGlThread: %x\n", eglGetCurrentContext());
        return eglGetCurrentContext() != 0;
    }
    return 0;
}
开发者ID:bundyo,项目名称:apkenv,代码行数:10,代码来源:worldofgoo.c


示例2: test_invalid_context

static bool
test_invalid_context(unsigned w, unsigned h, int fd, unsigned stride,
		unsigned offset)
{
	EGLImageKHR img;
	EGLint attr[] = {
		EGL_WIDTH, w,
		EGL_HEIGHT, h,
		EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
		EGL_DMA_BUF_PLANE0_FD_EXT, fd,
		EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset,
		EGL_DMA_BUF_PLANE0_PITCH_EXT, stride,
		EGL_NONE
	};

	/**
	 * The spec says:
	 *
	 *     "If <target> is EGL_LINUX_DMA_BUF_EXT, <dpy> must be a valid
	 *      display, <ctx> must be EGL_NO_CONTEXT, and <buffer> must be
	 *      NULL, cast into the type EGLClientBuffer."
	 */
	img = eglCreateImageKHR(eglGetCurrentDisplay(), eglGetCurrentContext(),
			EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)NULL, attr);

	if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
		if (img)
			eglDestroyImageKHR(eglGetCurrentDisplay(), img);
		return false;
	}

	return true;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:33,代码来源:invalid_attributes.c


示例3: eglGetCurrentDisplay

status_t GLConsumer::checkAndUpdateEglStateLocked(bool contextCheck) {
    EGLDisplay dpy = eglGetCurrentDisplay();
    EGLContext ctx = eglGetCurrentContext();

    if (!contextCheck) {
        // if this is the first time we're called, mEglDisplay/mEglContext have
        // never been set, so don't error out (below).
        if (mEglDisplay == EGL_NO_DISPLAY) {
            mEglDisplay = dpy;
        }
        if (mEglContext == EGL_NO_DISPLAY) {
            mEglContext = ctx;
        }
    }

    if (mEglDisplay != dpy || dpy == EGL_NO_DISPLAY) {
        ST_LOGE("checkAndUpdateEglState: invalid current EGLDisplay");
        return INVALID_OPERATION;
    }

    if (mEglContext != ctx || ctx == EGL_NO_CONTEXT) {
        ST_LOGE("checkAndUpdateEglState: invalid current EGLContext");
        return INVALID_OPERATION;
    }

    mEglDisplay = dpy;
    mEglContext = ctx;
    return NO_ERROR;
}
开发者ID:WayWingsDev,项目名称:Source_MT6582,代码行数:29,代码来源:GLConsumer.cpp


示例4: dreamTriInit

void dreamTriInit(int width, int height)
{
  // Configure Regal to log to file in /sdcard (disabled by default in this sample)
  // Note that for your own projects WRITE_EXTERNAL_STORAGE permission needs to be added to your AndroidManifest.xml
  setenv("REGAL_LOG_ALL", "0", 1);
  setenv("REGAL_LOG_ERROR", "1", 1);
  setenv("REGAL_LOG_FILE", "/sdcard/dreamri.log", 1);

  // This is not necessary when the EGL context is created natively, but is here as a reminder
  // to do register the EGL context with Regal when it is created by a Java thread. 
  RegalMakeCurrent(eglGetCurrentContext());

  glClearColor(0.0f, 0.0f, 0.0f, 0.5f);

  // avoid unlikely divide by zero
  if (height==0)
  {
    height=1;
  }

  float aspect = float(width)/float(height);

  glViewport(0, 0, width, height);
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  if( aspect > 1 ) {
    glFrustum( -0.1 * aspect, 0.1 * aspect, -0.1, 0.1, 0.1, 100.0 );
  } else {
    glFrustum( -0.1, 0.1, -0.1 / aspect, 0.1 / aspect, 0.1, 100.0 );
  }
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
}
开发者ID:sawillms,项目名称:BigAndroidBBQ2013,代码行数:33,代码来源:main.cpp


示例5: gettid

void Thread::InitMainThread()
{
    mainThreadId = gettid();

    currentContext = eglGetCurrentContext();
    if(currentContext == EGL_NO_CONTEXT)
    {
		Logger::Error("[Thread::InitMainThread] EGL_NO_CONTEXT");
    }

    currentDisplay = eglGetCurrentDisplay();
	if (currentDisplay == EGL_NO_DISPLAY)
	{
		Logger::Error("[Thread::InitMainThread] EGL_NO_DISPLAY");
	}

    currentDrawSurface = eglGetCurrentSurface(EGL_DRAW);
    if(currentDrawSurface == EGL_NO_SURFACE)
    {
		Logger::Error("[Thread::InitMainThread] EGL_NO_SURFACE | EGL_DRAW");
    }

    currentReadSurface = eglGetCurrentSurface(EGL_READ);
    if(currentReadSurface == EGL_NO_SURFACE)
    {
		Logger::Error("[Thread::InitMainThread] EGL_NO_SURFACE | EGL_READ");
    }


    Logger::Info("[Thread::InitMainThread] %ld", mainThreadId);
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:31,代码来源:ThreadAndroid.cpp


示例6: currentEglApi

// Helper function
EGLenum currentEglApi()
{
    EGLenum api = 0;
    if (EGL_NO_CONTEXT != eglGetCurrentContext())
        api = eglQueryAPI();
    return api;
}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:8,代码来源:s60videoeglrenderercontrol.cpp


示例7: Java_com_regal_dreamtri_DreamtriLib_init

JNIEXPORT void JNICALL Java_com_regal_dreamtri_DreamtriLib_init(JNIEnv *env, jobject obj,  jint width, jint height)
{
  // Configure Regal to log to file in /sdcard (disabled by default in this sample)
  // Note that for your own projects WRITE_EXTERNAL_STORAGE permission needs to be added to your AndroidManifest.xml
  setenv("REGAL_LOG_ALL", "0", 1);
  setenv("REGAL_LOG_ERROR", "1", 1);
  setenv("REGAL_LOG_FILE", "/sdcard/dreamri.log", 1);

  // Because teh EGL context was created by a Java thread, we need to register it with Regal.
  RegalMakeCurrent(eglGetCurrentContext());

  g_x = 0.0f;

  // Avoid unlikely divide by 0
  if (height==0)
    height=1;

  float aspect = float(width)/float(height);

  glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
  glViewport(0, 0, width, height);
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  if( aspect > 1 ) {
    glFrustum( -0.1 * aspect, 0.1 * aspect, -0.1, 0.1, 0.1, 100.0 );
  } else {
    glFrustum( -0.1, 0.1, -0.1 / aspect, 0.1 / aspect, 0.1, 100.0 );
  }
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
}
开发者ID:sawillms,项目名称:BigAndroidBBQ2013,代码行数:31,代码来源:gl_code.cpp


示例8: eglGetCurrentContext

TInt CEGLGraphicsInterface::BindClientBuffer(TUint aBuffer)
    {
    // Save current context and surfaces
    iSavedContext = eglGetCurrentContext();
    iSavedDrawSurface = eglGetCurrentSurface(EGL_DRAW);
    iSavedReadSurface = eglGetCurrentSurface(EGL_READ);
    
    if ( eglMakeCurrent( iEglDisplay,  EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
        {
        return MapEGLErrorCodeToSymbian(eglGetError());
        }

    const EGLint attribList2[] = {  EGL_NONE };
    iEglPbufSurface = eglCreatePbufferFromClientBuffer(iEglDisplay, EGL_OPENVG_IMAGE, (EGLClientBuffer)aBuffer,  iConfig, attribList2);
    
    if ( iEglPbufSurface == EGL_NO_SURFACE )
        {
        return MapEGLErrorCodeToSymbian(eglGetError());
        }

    if ( eglMakeCurrent( iEglDisplay,    iEglPbufSurface ,  iEglPbufSurface ,iEglContext ) == EGL_FALSE )
        {
        return MapEGLErrorCodeToSymbian(eglGetError());
        }
    return KErrNone;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:26,代码来源:eglgraphicsinterface.cpp


示例9: eglGetCurrentContext

void TilesManager::updateTilesIfContextVerified()
{
    EGLContext ctx = eglGetCurrentContext();
    GLUtils::checkEglError("contextChanged");
    if (ctx != m_eglContext) {
        if (m_eglContext != EGL_NO_CONTEXT) {
            // A change in EGL context is an unexpected error, but we don't want to
            // crash or ANR. Therefore, abandon the Surface Texture and GL resources;
            // they'll be recreated later in setupDrawing. (We can't delete them
            // since the context is gone)
            ALOGE("Unexpected : EGLContext changed! current %x , expected %x",
                  ctx, m_eglContext);
            transferQueue()->resetQueue();
            shader()->forceNeedsInit();
            videoLayerManager()->forceNeedsInit();
            markAllGLTexturesZero();
        } else {
            // This is the first time we went into this new EGL context.
            // We will have the GL resources to be re-inited and we can't update
            // dirty tiles yet.
            ALOGD("new EGLContext from framework: %x ", ctx);
        }
    } else {
        // Here before we draw, update the Tile which has updated content.
        // Inside this function, just do GPU blits from the transfer queue into
        // the Tiles' texture.
        transferQueue()->updateDirtyTiles();
        // Clean up GL textures for video layer.
        videoLayerManager()->deleteUnusedTextures();
    }
    m_eglContext = ctx;
    return;
}
开发者ID:3filiatd,项目名称:google_cache_invalidation_repo,代码行数:33,代码来源:TilesManager.cpp


示例10: PlatformGetNewRenderQuery

void PlatformGetNewRenderQuery(GLuint* OutQuery, uint64* OutQueryContext)
{
	if (!ReleasedQueriesGuard)
	{
		ReleasedQueriesGuard = new FCriticalSection;
	}

	{
		FScopeLock Lock(ReleasedQueriesGuard);

#ifdef UE_BUILD_DEBUG
		check(OutQuery && OutQueryContext);
#endif

		EGLContext Context = eglGetCurrentContext();
		check(Context);

		GLuint NewQuery = 0;

		/*
		 * Note, not reusing queries, because timestamp and occlusion are different
		 */

		if (!NewQuery)
		{
			FOpenGL::GenQueries(1, &NewQuery);
		}

		*OutQuery = NewQuery;
		*OutQueryContext = (uint64)Context;
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:32,代码来源:AndroidES31OpenGL.cpp


示例11: _glitz_egl_make_current

static void
_glitz_egl_make_current (void *abstract_drawable,
			 void *abstract_context)
{
    glitz_egl_context_t  *context = (glitz_egl_context_t *) abstract_context;
    glitz_egl_surface_t *drawable = (glitz_egl_surface_t *) abstract_drawable;
    glitz_egl_display_info_t *display_info =
	drawable->screen_info->display_info;

    if (drawable->base.width  != drawable->width ||
	drawable->base.height != drawable->height)
	_glitz_egl_drawable_update_size (drawable,
					 drawable->base.width,
					 drawable->base.height);

    if ((eglGetCurrentContext () != context->egl_context) ||
	(eglGetCurrentSurface ( EGL_READ ) != drawable->egl_surface))
    {
	if (display_info->thread_info->cctx)
	{
	    glitz_context_t *ctx = display_info->thread_info->cctx;

	    if (ctx->lose_current)
		ctx->lose_current (ctx->closure);
	}

	eglMakeCurrent (display_info->egl_display, drawable->egl_surface,
			drawable->egl_surface, context->egl_context);
    }

    display_info->thread_info->cctx = &context->base;
}
开发者ID:bonzini,项目名称:glitz,代码行数:32,代码来源:glitz_egl_context.c


示例12: ATRACE_CALL

status_t GLConsumer::detachFromContext() {
    ATRACE_CALL();
#ifndef MTK_DEFAULT_AOSP
    ST_LOGI("detachFromContext");
#else
    ST_LOGV("detachFromContext");
#endif
    Mutex::Autolock lock(mMutex);

    if (mAbandoned) {
        ST_LOGE("detachFromContext: abandoned GLConsumer");
        return NO_INIT;
    }

    if (!mAttached) {
        ST_LOGE("detachFromContext: GLConsumer is not attached to a "
                "context");
        return INVALID_OPERATION;
    }

    EGLDisplay dpy = eglGetCurrentDisplay();
    EGLContext ctx = eglGetCurrentContext();

    if (mEglDisplay != dpy && mEglDisplay != EGL_NO_DISPLAY) {
        ST_LOGE("detachFromContext: invalid current EGLDisplay");
        return INVALID_OPERATION;
    }

    if (mEglContext != ctx && mEglContext != EGL_NO_CONTEXT) {
        ST_LOGE("detachFromContext: invalid current EGLContext");
        return INVALID_OPERATION;
    }

    if (dpy != EGL_NO_DISPLAY && ctx != EGL_NO_CONTEXT) {
        status_t err = syncForReleaseLocked(dpy);
        if (err != OK) {
            return err;
        }

        glDeleteTextures(1, &mTexName);
    }

    // Because we're giving up the EGLDisplay we need to free all the EGLImages
    // that are associated with it.  They'll be recreated when the
    // GLConsumer gets attached to a new OpenGL ES context (and thus gets a
    // new EGLDisplay).
    for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
        EGLImageKHR img = mEglSlots[i].mEglImage;
        if (img != EGL_NO_IMAGE_KHR) {
            eglDestroyImageKHR(mEglDisplay, img);
            mEglSlots[i].mEglImage = EGL_NO_IMAGE_KHR;
        }
    }

    mEglDisplay = EGL_NO_DISPLAY;
    mEglContext = EGL_NO_CONTEXT;
    mAttached = false;

    return OK;
}
开发者ID:WayWingsDev,项目名称:Source_MT6582,代码行数:60,代码来源:GLConsumer.cpp


示例13: gtk_widget_set_double_buffered

void
GtkOvgGlue::prepDrawingArea(GtkWidget *drawing_area)
{
    GNASH_REPORT_FUNCTION;

    _drawing_area = drawing_area;
    
    // Disable double buffering, otherwise gtk tries to update widget
    // contents from its internal offscreen buffer at the end of expose event
    gtk_widget_set_double_buffered(_drawing_area, FALSE);

    // EGL needs to be bound to the type of client. The possible
    // clients are OpenVG, OpenGLES1, and OpenGLES2.
    if (_device->getType() == renderer::GnashDevice::EGL) {
        renderer::EGLDevice *egl = (renderer::EGLDevice*)_device.get();
        egl->bindClient(renderer::GnashDevice::OPENVG);
    }
    

    // Attach the window to the low level device
    long xid = GDK_WINDOW_XID(gtk_widget_get_window(drawing_area));
    _device->attachWindow(static_cast<renderer::GnashDevice::native_window_t>
                          (xid));

    //vgLoadIdentity();

#if 0
    renderer::EGLDevice *egl = (renderer::EGLDevice*)_device.get();
    egl->printEGLSurface(eglGetCurrentSurface(EGL_DRAW));
    egl->printEGLContext(eglGetCurrentContext());
#endif
}
开发者ID:BrandRegard,项目名称:gnash,代码行数:32,代码来源:gtk_glue_ovg.cpp


示例14: 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
}
开发者ID:slavablind91,项目名称:code,代码行数:27,代码来源:qglinfo.cpp


示例15: Java_com_uob_achohan_hdr_MyGLRenderer_initCL

JNIEXPORT void JNICALL Java_com_uob_achohan_hdr_MyGLRenderer_initCL(JNIEnv* jenv, jobject obj, jint width, jint height, jint in_tex, jint out_tex) {
	filter = new ReinhardGlobal(0.18f, 1.1f);
	filter->setStatusCallback(updateStatus);

	EGLDisplay mEglDisplay;
	EGLContext mEglContext;

	if ((mEglDisplay = eglGetCurrentDisplay()) == EGL_NO_DISPLAY) {
		status("eglGetCurrentDisplay() returned error %d", eglGetError());
	}

	if ((mEglContext = eglGetCurrentContext()) == EGL_NO_CONTEXT) {
		status("eglGetCurrentContext() returned error %d", eglGetError());
	}

	cl_prop[0] = CL_GL_CONTEXT_KHR;
	cl_prop[1] = (cl_context_properties) mEglContext;
	cl_prop[2] = CL_EGL_DISPLAY_KHR;
	cl_prop[3] = (cl_context_properties) mEglDisplay;
	cl_prop[4] = CL_CONTEXT_PLATFORM;
	cl_prop[6] = 0;

	params.opengl = true;

	filter->setImageSize(width, height);
	filter->setImageTextures(in_tex, out_tex);
	filter->setupOpenCL(cl_prop, params);

	return;
}
开发者ID:amirchohan,项目名称:HDR,代码行数:30,代码来源:hdr.cpp


示例16: gdk_x11_gl_context_dispose

static void
gdk_x11_gl_context_dispose (GObject *gobject)
{
  GdkWaylandGLContext *context_wayland = GDK_WAYLAND_GL_CONTEXT (gobject);

  if (context_wayland->egl_context != NULL)
    {
      GdkGLContext *context = GDK_GL_CONTEXT (gobject);
      GdkWindow *window = gdk_gl_context_get_window (context);
      GdkDisplay *display = gdk_window_get_display (window);
      GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);

      if (eglGetCurrentContext () == context_wayland->egl_context)
        eglMakeCurrent(display_wayland->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                       EGL_NO_CONTEXT);

      GDK_NOTE (OPENGL, g_print ("Destroying EGL context\n"));

      eglDestroyContext (display_wayland->egl_display,
                         context_wayland->egl_context);
      context_wayland->egl_context = NULL;
    }

  G_OBJECT_CLASS (gdk_wayland_gl_context_parent_class)->dispose (gobject);
}
开发者ID:Distrotech,项目名称:gtk,代码行数:25,代码来源:gdkglcontext-wayland.c


示例17: Java_org_yabause_android_YabauseRunnable_initViewport

int Java_org_yabause_android_YabauseRunnable_initViewport()
{
   int error;
   char * buf;

   g_Display = eglGetCurrentDisplay();
   g_Surface = eglGetCurrentSurface(EGL_READ);
   g_Context = eglGetCurrentContext();

   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrthof(0, 320, 224, 0, 1, 0);
   
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();

   glMatrixMode(GL_TEXTURE);
   glLoadIdentity();
   
   glDisable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   
   yprintf(glGetString(GL_VENDOR));
   yprintf(glGetString(GL_RENDERER));
   yprintf(glGetString(GL_VERSION));
   yprintf(glGetString(GL_EXTENSIONS));
   yprintf(eglQueryString(g_Display,EGL_EXTENSIONS));
   eglSwapInterval(g_Display,0);
   eglMakeCurrent(g_Display,EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
   return 0;
}
开发者ID:Amon-X,项目名称:yabause,代码行数:31,代码来源:yui.c


示例18: eglGetCurrentContext

/* EGLContext eglGetCurrentContext ( void ) */
static jobject
android_eglGetCurrentContext
  (JNIEnv *_env, jobject _this) {
    EGLContext _returnValue = (EGLContext) 0;
    _returnValue = eglGetCurrentContext();
    return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue);
}
开发者ID:shashlik,项目名称:old-gentroid-frameworks-base,代码行数:8,代码来源:android_opengl_EGL14.cpp


示例19: initCL

void initCL()
{
    dumpCLinfo();

    EGLDisplay mEglDisplay = eglGetCurrentDisplay();
    if (mEglDisplay == EGL_NO_DISPLAY)
        LOGE("initCL: eglGetCurrentDisplay() returned 'EGL_NO_DISPLAY', error = %x", eglGetError());

    EGLContext mEglContext = eglGetCurrentContext();
    if (mEglContext == EGL_NO_CONTEXT)
        LOGE("initCL: eglGetCurrentContext() returned 'EGL_NO_CONTEXT', error = %x", eglGetError());

    cl_context_properties props[] =
    {   CL_GL_CONTEXT_KHR,   (cl_context_properties) mEglContext,
        CL_EGL_DISPLAY_KHR,  (cl_context_properties) mEglDisplay,
        CL_CONTEXT_PLATFORM, 0,
        0 };

    try
    {
        cl::Platform p = cl::Platform::getDefault();
        std::string ext = p.getInfo<CL_PLATFORM_EXTENSIONS>();
        if(ext.find("cl_khr_gl_sharing") == std::string::npos)
            LOGE("Warning: CL-GL sharing isn't supported by PLATFORM");
        props[5] = (cl_context_properties) p();

        theContext = cl::Context(CL_DEVICE_TYPE_GPU, props);
        std::vector<cl::Device> devs = theContext.getInfo<CL_CONTEXT_DEVICES>();
        LOGD("Context returned %d devices, taking the 1st one", devs.size());
        ext = devs[0].getInfo<CL_DEVICE_EXTENSIONS>();
        if(ext.find("cl_khr_gl_sharing") == std::string::npos)
            LOGE("Warning: CL-GL sharing isn't supported by DEVICE");

        theQueue = cl::CommandQueue(theContext, devs[0]);

        cl::Program::Sources src(1, std::make_pair(oclProgI2I, sizeof(oclProgI2I)));
        theProgI2I = cl::Program(theContext, src);
        theProgI2I.build(devs);

        cv::ocl::attachContext(p.getInfo<CL_PLATFORM_NAME>(), p(), theContext(), devs[0]());
        if( cv::ocl::useOpenCL() )
            LOGD("OpenCV+OpenCL works OK!");
        else
            LOGE("Can't init OpenCV with OpenCL TAPI");
    }
    catch(cl::Error& e)
    {
        LOGE("cl::Error: %s (%d)", e.what(), e.err());
    }
    catch(std::exception& e)
    {
        LOGE("std::exception: %s", e.what());
    }
    catch(...)
    {
        LOGE( "OpenCL info: unknown error while initializing OpenCL stuff" );
    }
    LOGD("initCL completed");
}
开发者ID:boatx,项目名称:opencv,代码行数:59,代码来源:CLprocessor.cpp


示例20: eglGetCurrentDisplay

status_t SurfaceTexture::doGLFenceWaitLocked() const {

    EGLDisplay dpy = eglGetCurrentDisplay();
    EGLContext ctx = eglGetCurrentContext();

    if (mEglDisplay != dpy || mEglDisplay == EGL_NO_DISPLAY) {
        ST_LOGE("doGLFenceWait: invalid current EGLDisplay");
        return INVALID_OPERATION;
    }

    if (mEglContext != ctx || mEglContext == EGL_NO_CONTEXT) {
        ST_LOGE("doGLFenceWait: invalid current EGLContext");
        return INVALID_OPERATION;
    }

    if (mCurrentFence != NULL) {
        if (useWaitSync) {
            // Create an EGLSyncKHR from the current fence.
            int fenceFd = mCurrentFence->dup();
            if (fenceFd == -1) {
                ST_LOGE("doGLFenceWait: error dup'ing fence fd: %d", errno);
                return -errno;
            }
            EGLint attribs[] = {
                EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fenceFd,
                EGL_NONE
            };
            EGLSyncKHR sync = eglCreateSyncKHR(dpy,
                    EGL_SYNC_NATIVE_FENCE_ANDROID, attribs);
            if (sync == EGL_NO_SYNC_KHR) {
                close(fenceFd);
                ST_LOGE("doGLFenceWait: error creating EGL fence: %#x",
                        eglGetError());
                return UNKNOWN_ERROR;
            }

            // XXX: The spec draft is inconsistent as to whether this should
            // return an EGLint or void.  Ignore the return value for now, as
            // it's not strictly needed.
            eglWaitSyncANDROID(dpy, sync, 0);
            EGLint eglErr = eglGetError();
            eglDestroySyncKHR(dpy, sync);
            if (eglErr != EGL_SUCCESS) {
                ST_LOGE("doGLFenceWait: error waiting for EGL fence: %#x",
                        eglErr);
                return UNKNOWN_ERROR;
            }
        } else {
            status_t err = mCurrentFence->waitForever(1000,
                    "SurfaceTexture::doGLFenceWaitLocked");
            if (err != NO_ERROR) {
                ST_LOGE("doGLFenceWait: error waiting for fence: %d", err);
                return err;
            }
        }
    }

    return NO_ERROR;
}
开发者ID:Benzonat0r,项目名称:omx-components-u8500,代码行数:59,代码来源:SurfaceTexture.cpp



注:本文中的eglGetCurrentContext函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ eglGetCurrentSurface函数代码示例发布时间:2022-05-30
下一篇:
C++ eglGetConfigs函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap