当前位置: 首页>>代码示例>>C++>>正文


C++ eglGetCurrentContext函数代码示例

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


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


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