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


C++ eglQuerySurface函数代码示例

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


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

示例1: GetSurfaceSize

bool CEGLWrapper::GetSurfaceSize(EGLDisplay display, EGLSurface surface, EGLint *width, EGLint *height)
{
  if (!width || !height)
    return false;

  const bool failedToQuerySurfaceSize =
    !eglQuerySurface(display, surface, EGL_WIDTH, width) ||
    !eglQuerySurface(display, surface, EGL_HEIGHT, height);
  const bool invalidSurfaceSize =
    *width <= 0 || *height <= 0;

  if (failedToQuerySurfaceSize || invalidSurfaceSize)
    return false;

  return true;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:16,代码来源:EGLWrapper.cpp

示例2: gfx_ctx_get_video_size

static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
    if (g_egl_dpy)
    {
        EGLint gl_width, gl_height;
        eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
        eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
        *width  = gl_width;
        *height = gl_height;
    }
    else
    {
        *width  = 0;
        *height = 0;
    }
}
开发者ID:ZilverXZX,项目名称:RetroArch,代码行数:16,代码来源:bbqnx_ctx.c

示例3: eglMakeCurrent

bool GLHelper::makeCurrent(EGLSurface surface) {
    EGLint result;

    result = eglMakeCurrent(mDisplay, surface, surface, mContext);
    if (result != EGL_TRUE) {
        fprintf(stderr, "eglMakeCurrent error: %#x\n", eglGetError());
        return false;
    }

    EGLint w, h;
    eglQuerySurface(mDisplay, surface, EGL_WIDTH, &w);
    eglQuerySurface(mDisplay, surface, EGL_HEIGHT, &h);
    glViewport(0, 0, w, h);

    return true;
}
开发者ID:DolbyLaboratories,项目名称:mirror-aosp-platform-frameworks-native,代码行数:16,代码来源:GLHelper.cpp

示例4: gfx_ctx_get_resolution_width

static unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
{
    int gl_width;
    eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);

    return gl_width;
}
开发者ID:ZilverXZX,项目名称:RetroArch,代码行数:7,代码来源:bbqnx_ctx.c

示例5: initialize

int initialize()
{
    //Query width and height of the window surface created by utility code
    EGLint surface_width, surface_height;

	int dpi = bbutil_calculate_dpi(screen_cxt);

	font = bbutil_load_font("/usr/fonts/font_repository/monotype/tahoma.ttf", 6, dpi);
	if (!font)
		return EXIT_FAILURE;

	localDraw.SetFont(font);
	localDraw.SetScreenSize(width, height);

	eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width);
    eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height);

    width = surface_width;
    height = surface_height;

    // calculate the position of the next/prev buttons in world coordinates
    centerPrev.x = width / 2 - 88;
    centerNext.x = width / 2 + 88;
    centerPrev.y = height / 10;
    centerNext.y = height / 10;
    radius = 24;

	EGLint err = eglGetError();
	if (err != 0x3000)
	{
		fprintf(stderr, "Unable to query egl surface dimensions\n");
		return EXIT_FAILURE;
	}

    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClearDepthf(1.0);

    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    glEnable(GL_BLEND);
    glEnable(GL_LINE_SMOOTH);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    Resize(width, height);

	return EXIT_SUCCESS;
}
开发者ID:jwalkoski,项目名称:Box2D,代码行数:47,代码来源:bbmain.cpp

示例6: esCreateWindow

//  esCreateWindow()
//
//      title - name for title bar of window
//      width - width of window to create
//      height - height of window to create
//      flags  - bitwise or of window creation flags 
//          ES_WINDOW_ALPHA       - specifies that the framebuffer should have alpha
//          ES_WINDOW_DEPTH       - specifies that a depth buffer should be created
//          ES_WINDOW_STENCIL     - specifies that a stencil buffer should be created
//          ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, const char* title, GLint width, GLint height, GLuint flags )
{
   EGLint attribList[] =
   {
       EGL_RED_SIZE,       5,
       EGL_GREEN_SIZE,     6,
       EGL_BLUE_SIZE,      5,
       EGL_ALPHA_SIZE,     (flags & ES_WINDOW_ALPHA) ? 8 : EGL_DONT_CARE,
       EGL_DEPTH_SIZE,     (flags & ES_WINDOW_DEPTH) ? 24 : EGL_DONT_CARE,
       EGL_STENCIL_SIZE,   (flags & ES_WINDOW_STENCIL) ? 8 : EGL_DONT_CARE,
       EGL_SAMPLE_BUFFERS, (flags & ES_WINDOW_MULTISAMPLE) ? 1 : 0,
       EGL_NONE
   };
   
   if ( esContext == NULL )
   {
      return GL_FALSE;
   }

// create window (only for windows)
#ifdef _WIN32
   esContext->width = width;
   esContext->height = height;

   if ( !WinCreate ( esContext, title) )
   {
      return GL_FALSE;
   }
#endif

   if ( !CreateEGLContext ( esContext->hWnd,
                            &esContext->eglDisplay,
                            &esContext->eglContext,
                            &esContext->eglSurface,
                            attribList) )
   {
      return GL_FALSE;
   }

#ifdef __ANDROID__
	// get size
	eglQuerySurface(esContext->eglDisplay, esContext->eglSurface, EGL_WIDTH, &esContext->width);
	eglQuerySurface(esContext->eglDisplay, esContext->eglSurface, EGL_HEIGHT, & esContext->height);
#endif

   return GL_TRUE;
}
开发者ID:Gollos,项目名称:Gameloft_homework,代码行数:57,代码来源:esUtil.cpp

示例7: engine_init_display

/**
 * デバイスに対してのEGLコンテキストの初期化
 */
static int engine_init_display(struct engine* engine) {
    // OepGL ES と EGLの初期化

    const EGLint attribs[] =
            { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_BLUE_SIZE, 8,
                    EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_NONE };
    EGLint w, h, dummy, format;
    EGLint numConfigs;
    EGLConfig config;
    EGLSurface surface;
    EGLContext context;

    EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

    eglInitialize(display, 0, 0);

    eglChooseConfig(display, attribs, &config, 1, &numConfigs);

    eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);

    ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);

    surface = eglCreateWindowSurface(display, config, engine->app->window,
            NULL);
    context = eglCreateContext(display, config, NULL, NULL);

    if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
        LOGW("Unable to eglMakeCurrent");
        return -1;
    }

    eglQuerySurface(display, surface, EGL_WIDTH, &w);
    eglQuerySurface(display, surface, EGL_HEIGHT, &h);

    engine->display = display;
    engine->context = context;
    engine->surface = surface;
    engine->width = w;
    engine->height = h;
    engine->state.angle = 0;

    // ボックス表示の初期化
    initBox(engine);

    return 0;
}
开发者ID:h-godai,项目名称:ssa,代码行数:49,代码来源:main.cpp

示例8: eglCreateWindowSurface

void QWebOSGLContext::createSurface()
{
    m_eglSurface = eglCreateWindowSurface(s_eglDisplay, m_eglConfig,
                                          m_platformWindow->getEglWindow(),
                                          NULL);

    if (m_eglSurface == EGL_NO_SURFACE) {
        qDebug("Could not create the egl surface: error = 0x%x\n", eglGetError());
        eglTerminate(s_eglDisplay);
        qFatal("EGL error");
    }

    EGLint w, h;
    eglQuerySurface(s_eglDisplay, m_eglSurface, EGL_WIDTH, &w);
    eglQuerySurface(s_eglDisplay, m_eglSurface, EGL_HEIGHT, &h);
    m_surfaceSize = QSize(w,h);
}
开发者ID:Tofee,项目名称:qt-webos-plugin,代码行数:17,代码来源:qwebosglcontext.cpp

示例9: gfx_ctx_qnx_get_video_size

static void gfx_ctx_qnx_get_video_size(void *data, unsigned *width, unsigned *height)
{
   EGLint gl_width, gl_height;

   (void)data;

   *width  = 0;
   *height = 0;

   if (!g_egl_dpy)
      return;

   eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
   eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
   *width  = gl_width;
   *height = gl_height;
}
开发者ID:chungy,项目名称:RetroArch,代码行数:17,代码来源:bbqnx_ctx.c

示例10: eglQuerySurface

GUI::UInt32
CAndroidGLESWindowContext::GetWidth( void ) const
{GUCEF_TRACE;

    EGLint width = 0;
    eglQuerySurface( m_display, m_surface, EGL_WIDTH, &width );
    return width;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:8,代码来源:guidriverAndroidGLES_CAndroidGLESWindowContext.cpp

示例11: initializeWindow

void initializeWindow()
{
	const EGLint attribs[] =
	{
		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		EGL_BLUE_SIZE, 8,
		EGL_GREEN_SIZE, 8,
		EGL_RED_SIZE, 8,
		EGL_NONE
	};
	EGLint w, h, dummy, format;
	EGLint numConfigs;
	EGLConfig config;
	EGLSurface surface;
	EGLContext context;

	//-- get the display
	EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
	eglInitialize(display, 0, 0);
	//-- choose config for the display
	eglChooseConfig(display, attribs, &config, 1, &numConfigs);
	//-- get format attributes to pass to the native window
	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
	//-- set format for the native window
	ANativeWindow_setBuffersGeometry(_device.app->window, 0, 0, format);

	//-- create a surface and context to draw on
	surface = eglCreateWindowSurface(display, config, _device.app->window, NULL);
	context = eglCreateContext(display, config, NULL, NULL);

	//-- get the display dimensions
	eglQuerySurface(display, surface, EGL_WIDTH, &w);
	eglQuerySurface(display, surface, EGL_HEIGHT, &h);


	if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
		//LOGW("Unable to eglMakeCurrent");
		//return -1;
	}

	_device.Display.display = display;
	_device.Display.context = context;
	_device.Display.surface = surface;
	_device.Display.width = w;
	_device.Display.height = h;
}
开发者ID:juanwinsor,项目名称:dubEngine,代码行数:46,代码来源:main.cpp

示例12: Init

EGLint GLContext::Resume( ANativeWindow* window )
{
    if( egl_context_initialized_ == false )
    {
        Init( window );
        return EGL_SUCCESS;
    }

    int32_t original_widhth = screen_width_;
    int32_t original_height = screen_height_;

    //Create surface
    window_ = window;
    surface_ = eglCreateWindowSurface( display_, config_, window_, NULL );
    eglQuerySurface( display_, surface_, EGL_WIDTH, &screen_width_ );
    eglQuerySurface( display_, surface_, EGL_HEIGHT, &screen_height_ );

    if( screen_width_ != original_widhth || screen_height_ != original_height )
    {
        //Screen resized
        LOGI( "Screen resized" );
    }

    if( eglMakeCurrent( display_, surface_, surface_, context_ ) == EGL_TRUE )
        return EGL_SUCCESS;

    EGLint err = eglGetError();
    LOGW( "Unable to eglMakeCurrent %d", err );

    if( err == EGL_CONTEXT_LOST )
    {
        //Recreate context
        LOGI( "Re-creating egl context" );
        InitEGLContext();
    }
    else
    {
        //Recreate surface
        Terminate();
        InitEGLSurface();
        InitEGLContext();
    }

    return err;

}
开发者ID:007gzs,项目名称:android-platform-ndk,代码行数:46,代码来源:GLContext.cpp

示例13: Draw

///
// Draw a triangle using the shader pair created in Init()
//
void Draw(Example *example)
{
    UserData *userData = (UserData *)example->userptr;

    // Set the viewport
    EGLint width = 0; 
    EGLint height = 0;
    eglQuerySurface(example->egl.display, example->egl.surface, EGL_WIDTH, &width);
    eglQuerySurface(example->egl.display, example->egl.surface, EGL_HEIGHT, &height);
    glViewport(0, 0, width, height);

    // Clear the color buffer
    glClear(GL_COLOR_BUFFER_BIT);

    // Load the vertex attributes
    glBindBuffer(GL_ARRAY_BUFFER, userData->vertexObject);
    glVertexAttribPointer(userData->lifetimeLoc, 1, GL_FLOAT,
        GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
        (const GLvoid *)0);

    glVertexAttribPointer(userData->endPositionLoc, 3, GL_FLOAT,
        GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
        (const GLvoid *)4);

    glVertexAttribPointer(userData->startPositionLoc, 3, GL_FLOAT,
        GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
        (const GLvoid *)16);


    glEnableVertexAttribArray(userData->lifetimeLoc);
    glEnableVertexAttribArray(userData->endPositionLoc);
    glEnableVertexAttribArray(userData->startPositionLoc);
    // Blend particles
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);

    // Bind the texture
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, userData->textureId);

    // Set the sampler texture unit to 0
    glUniform1i(userData->samplerLoc, 0);

    glDrawArrays(GL_POINTS, 0, NUM_PARTICLES);
}
开发者ID:h-s-c,项目名称:libKD,代码行数:48,代码来源:example_glbook_particle.c

示例14: gfx_ctx_vivante_get_video_size

static void gfx_ctx_vivante_get_video_size(void *data,
      unsigned *width, unsigned *height)
{
   (void)data;

   *width  = 0;
   *height = 0;

   if (g_egl_dpy != EGL_NO_DISPLAY && g_egl_surf != EGL_NO_SURFACE)
   {
      EGLint gl_width, gl_height;

      eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
      eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
      *width  = gl_width;
      *height = gl_height;
   }
}
开发者ID:Joonie86,项目名称:RetroArch,代码行数:18,代码来源:vivante_fbdev_ctx.c

示例15: OGRE_EXCEPT

    ::EGLConfig EGLSupport::getGLConfigFromDrawable(::EGLSurface drawable,
                                                    unsigned int *w, unsigned int *h)
    {
        ::EGLConfig glConfig = 0;

        if (eglQuerySurface(mGLDisplay, drawable, EGL_CONFIG_ID, (EGLint *) &glConfig) == EGL_FALSE)
        {
            OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
                        "Fail to get config from drawable",
                        __FUNCTION__);
            return 0;
        }

        eglQuerySurface(mGLDisplay, drawable, EGL_WIDTH, (EGLint *) w);
        eglQuerySurface(mGLDisplay, drawable, EGL_HEIGHT, (EGLint *) h);

        return glConfig;
    }
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:18,代码来源:OgreEGLSupport.cpp


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