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


C++ eglGetCurrentSurface函数代码示例

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


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

示例1: _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

示例2: jni_eglGetCurrentSurface

static jlong jni_eglGetCurrentSurface(JNIEnv *_env, jobject _this, jint readdraw) {
    if ((readdraw != EGL_READ) && (readdraw != EGL_DRAW)) {
        jniThrowException(_env, "java/lang/IllegalArgumentException", NULL);
        return 0;
    }
    return reinterpret_cast<jlong>(eglGetCurrentSurface(readdraw));
}
开发者ID:1477584437,项目名称:platform_frameworks_base,代码行数:7,代码来源:com_google_android_gles_jni_EGLImpl.cpp

示例3: 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:d356,项目名称:yabause-ci-test,代码行数:31,代码来源:yui.c

示例4: CopyBitmapL

void CEGLGraphicsInterface::CopyBitmapL(CFbsBitmap* aPixMap, CFbsBitmap* )
    {
    if (eglCopyBuffers(iEglDisplay, eglGetCurrentSurface(EGL_READ), aPixMap) == EGL_FALSE)
        {
        User::Leave(MapEGLErrorCodeToSymbian(eglGetError()));
        }
    aPixMap->SetDisplayMode(aPixMap->DisplayMode());
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:8,代码来源:eglgraphicsinterface.cpp

示例5: ASSERT

void EGLDisplayOpenVG::removeSurface(const EGLSurface& surface, bool destroySurface)
{
    ASSERT(surface != EGL_NO_SURFACE);

#if PLATFORM(OLYMPIA)
    if (destroySurface) {
        // Work around a bug in our EGL implementation where the VGImage
        // referenced by eglCreatePbufferFromClientBuffer is not released
        // when destroying the context, RIM Bug #1591.
        // The context that created the VGImage needs to be current for
        // it to be released.
        sharedPlatformSurface()->makeResourceCreationContextCurrent();
    } else
#endif
    if (eglGetCurrentSurface(EGL_DRAW) == surface) {
        eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
        ASSERT_EGL_NO_ERROR();
    }

    // Destroy the context associated to the surface, if we already created one.
    if (m_surfaceConfigIds.contains(surface)) {
        EGLint surfaceConfigId = m_surfaceConfigIds.take(surface); // take = get and remove
        bool isContextReferenced = false;

        if (m_compatibleConfigIds.contains(surfaceConfigId))
            surfaceConfigId = m_compatibleConfigIds.get(surfaceConfigId);

        HashMap<EGLSurface, EGLint>::iterator end = m_surfaceConfigIds.end();

        // ...but only if there's no other surfaces associated to that context.
        for (HashMap<EGLSurface, EGLint>::iterator it = m_surfaceConfigIds.begin(); it != end; ++it) {
            if ((*it).second == surfaceConfigId) {
                isContextReferenced = true;
                break;
            }
        }
        if (!isContextReferenced && m_contexts.contains(surfaceConfigId)) {
            EGLContext context = m_contexts.take(surfaceConfigId);
            eglDestroyContext(m_display, context);
            ASSERT_EGL_NO_ERROR();
        }
    }

    m_platformSurfaces.remove(surface);

    HashMap<EGLNativeWindowType, EGLSurface>::iterator end = m_windowSurfaces.end();
    for (HashMap<EGLNativeWindowType, EGLSurface>::iterator it = m_windowSurfaces.begin(); it != end; ++it) {
        if ((*it).second == surface) {
            m_windowSurfaces.remove(it);
            break;
        }
    }

    if (destroySurface) {
        eglDestroySurface(m_display, surface);
        ASSERT_EGL_NO_ERROR();
    }
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:58,代码来源:EGLDisplayOpenVG.cpp

示例6: Q_ASSERT

bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
{
    Q_ASSERT(surface->surface()->supportsOpenGL());

    eglBindAPI(m_api);

    EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);

    if (eglSurface == EGL_NO_SURFACE)
        return false;

    // shortcut: on some GPUs, eglMakeCurrent is not a cheap operation
    if (eglGetCurrentContext() == m_eglContext &&
        eglGetCurrentDisplay() == m_eglDisplay &&
        eglGetCurrentSurface(EGL_READ) == eglSurface &&
        eglGetCurrentSurface(EGL_DRAW) == eglSurface) {
        return true;
    }

    const bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
    if (ok) {
        if (!m_swapIntervalEnvChecked) {
            m_swapIntervalEnvChecked = true;
            if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_SWAPINTERVAL")) {
                QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
                bool intervalOk;
                const int swapInterval = swapIntervalString.toInt(&intervalOk);
                if (intervalOk)
                    m_swapIntervalFromEnv = swapInterval;
            }
        }
        const int requestedSwapInterval = m_swapIntervalFromEnv >= 0
            ? m_swapIntervalFromEnv
            : surface->format().swapInterval();
        if (requestedSwapInterval >= 0 && m_swapInterval != requestedSwapInterval) {
            m_swapInterval = requestedSwapInterval;
            if (eglSurface != EGL_NO_SURFACE) // skip if using surfaceless context
                eglSwapInterval(eglDisplay(), m_swapInterval);
        }
    } else {
        qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError());
    }

    return ok;
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:45,代码来源:qeglplatformcontext.cpp

示例7: eglGetCurrentSurface

/* EGLSurface eglGetCurrentSurface ( EGLint readdraw ) */
static jobject
android_eglGetCurrentSurface
  (JNIEnv *_env, jobject _this, jint readdraw) {
    EGLSurface _returnValue = (EGLSurface) 0;
    _returnValue = eglGetCurrentSurface(
        (EGLint)readdraw
    );
    return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
}
开发者ID:shashlik,项目名称:old-gentroid-frameworks-base,代码行数:10,代码来源:android_opengl_EGL14.cpp

示例8: evgl_eng_make_current

static int 
evgl_eng_make_current(void *data, void *surface, void *ctxt, int flush)
{
   Render_Engine *re;
   Outbuf *ob;
   EGLContext ctx;
   EGLSurface surf;
   int ret = 0;

   if (!(re = (Render_Engine *)data)) return 0;
   if (!(ob = eng_get_ob(re))) return 0;

   ctx = (EGLContext)ctxt;
   surf = (EGLSurface)surface;

   if ((!ctxt) && (!surface))
     {
        ret = 
          eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, 
                         EGL_NO_SURFACE, EGL_NO_CONTEXT);
        if (!ret)
          {
             ERR("eglMakeCurrent Failed: %#x", eglGetError());
             return 0;
          }
        return 1;
     }

   if ((eglGetCurrentContext() != ctx) || 
       (eglGetCurrentSurface(EGL_READ) != surf) || 
       (eglGetCurrentSurface(EGL_DRAW) != surf))
     {
        if (flush) eng_window_use(NULL);

        ret = eglMakeCurrent(ob->egl_disp, surf, surf, ctx);
        if (!ret)
          {
             ERR("eglMakeCurrent Failed: %#x", eglGetError());
             return 0;
          }
     }

   return 1;
}
开发者ID:FlorentRevest,项目名称:EFL,代码行数:44,代码来源:evas_engine.c

示例9: defined

void
TopCanvas::Resume()
{
#if defined(ANDROID) && defined(USE_EGL)
  surface = eglGetCurrentSurface(EGL_DRAW);
#endif

  OpenGL::SetupContext();
  OpenGL::SetupViewport(UnsignedPoint2D(size.cx, size.cy));
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:10,代码来源:TopCanvas.cpp

示例10: eglGetCurrentSurface

    void EGLWindow::setVSyncEnabled(bool vsync) {
        mVSync = vsync;
        // we need to make our context current to set vsync
        // store previous context to restore when finished.
        ::EGLSurface oldRead = eglGetCurrentSurface(EGL_READ);
        EGL_CHECK_ERROR
        ::EGLSurface oldDraw = eglGetCurrentSurface(EGL_DRAW);
        EGL_CHECK_ERROR
        ::EGLContext  oldContext  = eglGetCurrentContext();
        EGL_CHECK_ERROR
        ::EGLDisplay dpy = mGLSupport->getGLDisplay();

        mContext->setCurrent();

        if (! mIsExternalGLControl )
        {
            eglSwapInterval(dpy, vsync ? mVSyncInterval : 0);
            EGL_CHECK_ERROR
        }
开发者ID:yiliu1203,项目名称:OGRE,代码行数:19,代码来源:OgreEGLWindow.cpp

示例11: recreate

    void recreate(void)
    {
        EGLContext currentContext = eglGetCurrentContext();
        EGLSurface currentDrawSurface = eglGetCurrentSurface(EGL_DRAW);
        EGLSurface currentReadSurface = eglGetCurrentSurface(EGL_READ);
        bool rebindDrawSurface = currentDrawSurface == surface;
        bool rebindReadSurface = currentReadSurface == surface;

        if (rebindDrawSurface || rebindReadSurface) {
            eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
            eglDestroySurface(eglDisplay, surface);
        }

        const EglVisual * eglVisual = static_cast<const EglVisual *>(visual);
        ANativeWindow_setBuffersGeometry(window.get(), 0, 0, eglVisual->format);
        surface = eglCreateWindowSurface(eglDisplay, eglVisual->config, (EGLNativeWindowType)window.get(), NULL);

        if (rebindDrawSurface || rebindReadSurface)
            eglMakeCurrent(eglDisplay, surface, surface, currentContext);
    }
开发者ID:goneflash,项目名称:apitrace,代码行数:20,代码来源:glws_egl_android.cpp

示例12: FScopeContext

	FScopeContext(FPlatformOpenGLContext* PlatformContext)
	{
		check(PlatformContext);
		LastContext = eglGetCurrentContext();
		LastSurface = eglGetCurrentSurface(EGL_DRAW);
		bSameContextAndSurface = (LastContext == PlatformContext->eglContext) && (LastSurface == PlatformContext->eglSurface);
		if (!bSameContextAndSurface)
		{
			eglMakeCurrent(AndroidEGL::GetInstance()->GetDisplay(), PlatformContext->eglSurface, PlatformContext->eglSurface, PlatformContext->eglContext);
		}
	}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:11,代码来源:AndroidES31OpenGL.cpp

示例13: eglGetDisplay

void
TopCanvas::Create(PixelSize new_size, bool full_screen, bool resizable)
{
#ifdef USE_EGL
  display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
  surface = eglGetCurrentSurface(EGL_DRAW);
#endif

  OpenGL::SetupContext();
  SetupViewport(new_size);
}
开发者ID:nkgautam,项目名称:XCSoar,代码行数:11,代码来源:TopCanvas.cpp

示例14: GLimp_EndFrame

/*
** GLimp_EndFrame
*/
void GLimp_EndFrame (void)
{
	  if (!androidSwapped)
	    	eglSwapBuffers( eglGetCurrentDisplay(), eglGetCurrentSurface( EGL_DRAW ) );

	    androidSwapped = false;


	// check logging
	QGL_EnableLogging( r_logFile->integer );
}
开发者ID:emileb,项目名称:JK3,代码行数:14,代码来源:android_glimp.cpp

示例15: _Create

    bool DiWin32EGLWindow::Create(uint32& width, uint32& height, const DiString& title, bool fullscreen)
    {
        ::EGLContext eglContext = 0;
        if (!mEglConfig)
        {
            uint32 samples = 0;
            int minAttribs[] = 
            {
                EGL_LEVEL, 0,
                EGL_DEPTH_SIZE, 16,
                EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
                EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
                EGL_NATIVE_RENDERABLE, EGL_FALSE,
                EGL_DEPTH_SIZE, EGL_DONT_CARE,
                EGL_NONE
            };

            int maxAttribs[] = 
            {
                EGL_SAMPLES, samples,
                EGL_STENCIL_SIZE, INT_MAX,
                EGL_NONE
            };

            mEglConfig = mGLSupport->SelectGLConfig(minAttribs, maxAttribs);
        }

        bool ret = _Create(width, height, title, fullscreen);

        mContext = CreateEGLContext();
        mContext->BeginContext();
        ::EGLSurface oldDrawableDraw = eglGetCurrentSurface(EGL_DRAW);
        ::EGLSurface oldDrawableRead = eglGetCurrentSurface(EGL_READ);
        ::EGLContext oldContext = eglGetCurrentContext();

        int glConfigID;
        mGLSupport->GetGLConfigAttrib(mEglConfig, EGL_CONFIG_ID, &glConfigID);

        DI_INFO("EGLWindow::create used FBConfigID = %d", glConfigID);
        return ret;
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:41,代码来源:Win32EGLWindow.cpp


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