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

C++ eglQuerySurface函数代码示例

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

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



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


示例16: IJK_EGL_getSurfaceHeight

static int IJK_EGL_getSurfaceHeight(IJK_EGL* egl)
{
    EGLint height = 0;
    if (!eglQuerySurface(egl->display, egl->surface, EGL_HEIGHT, &height)) {
        ALOGE("[EGL] eglQuerySurface(EGL_HEIGHT) returned error %d", eglGetError());
        return 0;
    }

    return height;
}
开发者ID:317394245,项目名称:ijkplayer,代码行数:10,代码来源:ijksdl_egl.c


示例17: IJK_EGL_getSurfaceWidth

static int IJK_EGL_getSurfaceWidth(IJK_EGL* egl)
{
    EGLint width = 0;
    if (!eglQuerySurface(egl->display, egl->surface, EGL_WIDTH, &width)) {
        ALOGE("[EGL] eglQuerySurface(EGL_WIDTH) returned error %d", eglGetError());
        return 0;
    }

    return width;
}
开发者ID:317394245,项目名称:ijkplayer,代码行数:10,代码来源:ijksdl_egl.c


示例18: initialize

void initialize()
{
	//Initialize vertex and color data
    vertices[0] = -0.25f;
    vertices[1] = -0.25f;

    vertices[2] = 0.25f;
    vertices[3] = -0.25f;

    vertices[4] = -0.25f;
    vertices[5] = 0.25f;

    vertices[6] = 0.25f;
    vertices[7] = 0.25f;

    colors[0] = 1.0f;
    colors[1] = 0.0f;
    colors[2] = 1.0f;
    colors[3] = 1.0f;

    colors[4] = 1.0f;
    colors[5] = 1.0f;
    colors[6] = 0.0f;
    colors[7] = 1.0f;

    colors[8] = 0.0f;
    colors[9] = 1.0f;
    colors[10] = 1.0f;
    colors[11] = 1.0f;

    colors[12] = 0.0f;
    colors[13] = 1.0f;
    colors[14] = 1.0f;
    colors[15] = 1.0f;

    //Query width and height of the window surface created by utility code
    EGLint surface_width, surface_height;

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

    glTranslatef((float)(surface_width) / (float)(surface_height) / 2, 0.5f, 0.0f);
}
开发者ID:dtomilovskiy,项目名称:NDK-Samples,代码行数:43,代码来源:main.c


示例19: eglQuerySurface

	void AndroidEGLWindow::windowMovedOrResized()
	{
        if(mActive)
        {		
			// When using GPU rendering for Android UI the os creates a context in the main thread
			// Now we have 2 choices create OGRE in its own thread or set our context current before doing
			// anything else. I put this code here because this function called before any rendering is done.
			// Because the events for screen rotation / resizing did not worked on all devices it is the best way
			// to query the correct dimensions.
	        mContext->setCurrent(); 
            eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, (EGLint*)&mWidth);
            eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, (EGLint*)&mHeight);
            
            // Notify viewports of resize
            ViewportList::iterator it = mViewportList.begin();
            while( it != mViewportList.end() )
                (*it++).second->_updateDimensions();
        }
	}
开发者ID:Ali-il,项目名称:gamekit,代码行数:19,代码来源:OgreAndroidEGLWindow.cpp


示例20: eglGetDisplay

bool GLContext::InitEGLSurface() {
  display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
  eglInitialize(display_, 0, 0);

  /*
   * Here specify the attributes of the desired configuration.
   * Below, we select an EGLConfig with at least 8 bits per color
   * component compatible with on-screen windows
   */
  const EGLint attribs[] = {
      EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,  // Request opengl ES2.0
      EGL_SURFACE_TYPE,    EGL_WINDOW_BIT,     EGL_BLUE_SIZE, 8,
      EGL_GREEN_SIZE,      8,                  EGL_RED_SIZE,  8,
      EGL_DEPTH_SIZE,      24,                 EGL_NONE};
  color_size_ = 8;
  depth_size_ = 24;

  EGLint num_configs;
  eglChooseConfig(display_, attribs, &config_, 1, &num_configs);

  if (!num_configs) {
    // Fall back to 16bit depth buffer
    const EGLint attribs[] = {
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,  // Request opengl ES2.0
        EGL_SURFACE_TYPE,    EGL_WINDOW_BIT,     EGL_BLUE_SIZE, 8,
        EGL_GREEN_SIZE,      8,                  EGL_RED_SIZE,  8,
        EGL_DEPTH_SIZE,      16,                 EGL_NONE};
    eglChooseConfig(display_, attribs, &config_, 1, &num_configs);
    depth_size_ = 16;
  }

  if (!num_configs) {
    LOGW("Unable to retrieve EGL config");
    return false;
  }

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

  return true;
}
开发者ID:03050903,项目名称:android-ndk,代码行数:42,代码来源:GLContext.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ eglReleaseThread函数代码示例发布时间:2022-05-30
下一篇:
C++ eglQueryString函数代码示例发布时间: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