本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例10: eglQuerySurface
GUI::UInt32
CAndroidGLESWindowContext::GetWidth( void ) const
{GUCEF_TRACE;
EGLint width = 0;
eglQuerySurface( m_display, m_surface, EGL_WIDTH, &width );
return width;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}