本文整理汇总了C++中COGL_FRAMEBUFFER函数的典型用法代码示例。如果您正苦于以下问题:C++ COGL_FRAMEBUFFER函数的具体用法?C++ COGL_FRAMEBUFFER怎么用?C++ COGL_FRAMEBUFFER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COGL_FRAMEBUFFER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _cogl_winsys_onscreen_bind
static void
_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = fb->context;
CoglContextSdl2 *sdl_context = context->winsys;
CoglDisplaySdl2 *sdl_display = context->display->winsys;
CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys;
if (sdl_context->current_window == sdl_onscreen->window)
return;
SDL_GL_MakeCurrent (sdl_onscreen->window, sdl_display->context);
sdl_context->current_window = sdl_onscreen->window;
/* It looks like SDL just directly calls a glXSwapInterval function
* when this is called. This may be provided by either the EXT
* extension, the SGI extension or the Mesa extension. The SGI
* extension is per context so we can't just do this once when the
* framebuffer is allocated. See the comments in the GLX winsys for
* more info. */
if (COGL_FLAGS_GET (context->winsys_features,
COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE))
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
SDL_GL_SetSwapInterval (fb->config.swap_throttled ? 1 : 0);
}
}
开发者ID:djdeath,项目名称:cogl-android,代码行数:30,代码来源:cogl-winsys-sdl2.c
示例2: handle_event
static void
handle_event (Data *data, SDL_Event *event)
{
switch (event->type)
{
case SDL_VIDEOEXPOSE:
data->redraw_queued = TRUE;
break;
case SDL_MOUSEMOTION:
{
int width =
cogl_framebuffer_get_width (COGL_FRAMEBUFFER (data->fb));
int height =
cogl_framebuffer_get_height (COGL_FRAMEBUFFER (data->fb));
data->center_x = event->motion.x * 2.0f / width - 1.0f;
data->center_y = event->motion.y * 2.0f / height - 1.0f;
data->redraw_queued = TRUE;
}
break;
case SDL_QUIT:
data->quit = TRUE;
break;
}
}
开发者ID:djdeath,项目名称:cogl-android,代码行数:28,代码来源:cogl-sdl-hello.c
示例3: _cogl_winsys_onscreen_deinit
static void
_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
{
CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys;
if (sdl_onscreen->window != NULL)
{
CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
CoglContextSdl2 *sdl_context = context->winsys;
if (sdl_context->current_window == sdl_onscreen->window)
{
CoglDisplaySdl2 *sdl_display = context->display->winsys;
/* SDL explicitly unbinds the context when the currently
* bound window is destroyed. Cogl always needs a context
* bound so that for example it can create texture resources
* at any time even without flushing a framebuffer.
* Therefore we'll bind the dummy window. */
SDL_GL_MakeCurrent (sdl_display->dummy_window,
sdl_display->context);
sdl_context->current_window = sdl_display->dummy_window;
}
SDL_DestroyWindow (sdl_onscreen->window);
sdl_onscreen->window = NULL;
}
g_slice_free (CoglOnscreenSdl2, sdl_onscreen);
onscreen->winsys = NULL;
}
开发者ID:djdeath,项目名称:cogl-android,代码行数:31,代码来源:cogl-winsys-sdl2.c
示例4: clutter_stage_win32_get_active_framebuffer
static CoglFramebuffer *
clutter_stage_win32_get_active_framebuffer (ClutterStageWindow *stage_window)
{
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (stage_window);
return COGL_FRAMEBUFFER (stage_win32->onscreen);
}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:7,代码来源:clutter-stage-win32.c
示例5: _cogl_winsys_egl_onscreen_init
static CoglBool
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
EGLConfig egl_config,
CoglError **error)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = framebuffer->context;
CoglDisplay *display = context->display;
CoglDisplayEGL *egl_display = display->winsys;
CoglDisplayGDL *gdl_display = egl_display->platform;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
if (gdl_display->have_onscreen)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"EGL platform only supports a single onscreen window");
return FALSE;
}
egl_onscreen->egl_surface = egl_display->egl_surface;
_cogl_framebuffer_winsys_update_size (framebuffer,
gdl_display->egl_surface_width,
gdl_display->egl_surface_height);
gdl_display->have_onscreen = TRUE;
return TRUE;
}
开发者ID:gcampax,项目名称:cogl,代码行数:29,代码来源:cogl-winsys-egl-gdl.c
示例6: test_backface_culling
void
test_backface_culling (void)
{
TestState state;
CoglTexture *tex;
state.width = cogl_framebuffer_get_width (test_fb);
state.height = cogl_framebuffer_get_height (test_fb);
state.offscreen = NULL;
state.texture = make_texture ();
tex = cogl_texture_new_with_size (state.width, state.height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY); /* internal fmt */
state.offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (tex));
state.offscreen_tex = tex;
paint (&state);
cogl_object_unref (state.offscreen);
cogl_object_unref (state.offscreen_tex);
cogl_object_unref (state.texture);
if (cogl_test_verbose ())
g_print ("OK\n");
}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:28,代码来源:test-backface-culling.c
示例7: test_color_mask
void
test_color_mask (void)
{
TestState state;
int i;
state.width = cogl_framebuffer_get_width (test_fb);
state.height = cogl_framebuffer_get_height (test_fb);
for (i = 0; i < NUM_FBOS; i++)
{
state.tex[i] = test_utils_texture_new_with_size (test_ctx, 128, 128,
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGB_888);
state.fbo[i] = COGL_FRAMEBUFFER (
cogl_offscreen_new_to_texture (state.tex[i]));
/* Clear the texture color bits */
cogl_framebuffer_clear4f (state.fbo[i],
COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
cogl_framebuffer_set_color_mask (state.fbo[i],
i == 0 ? COGL_COLOR_MASK_RED :
i == 1 ? COGL_COLOR_MASK_GREEN :
COGL_COLOR_MASK_BLUE);
}
paint (&state);
if (cogl_test_verbose ())
g_print ("OK\n");
}
开发者ID:gcampax,项目名称:cogl,代码行数:34,代码来源:test-color-mask.c
示例8: _cogl_winsys_onscreen_deinit
static void
_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = framebuffer->context;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
/* If we never successfully allocated then there's nothing to do */
if (egl_onscreen == NULL)
return;
if (egl_onscreen->egl_surface != EGL_NO_SURFACE)
{
if (eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface)
== EGL_FALSE)
g_warning ("Failed to destroy EGL surface");
egl_onscreen->egl_surface = EGL_NO_SURFACE;
}
if (egl_renderer->platform_vtable->onscreen_deinit)
egl_renderer->platform_vtable->onscreen_deinit (onscreen);
g_slice_free (CoglOnscreenEGL, onscreen->winsys);
onscreen->winsys = NULL;
}
开发者ID:collects,项目名称:cogl,代码行数:26,代码来源:cogl-winsys-egl.c
示例9: _cogl_winsys_onscreen_bind
static void
_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = fb->context;
CoglDisplayEGL *egl_display = context->display->winsys;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglContextEGL *egl_context = context->winsys;
if (egl_context->current_surface == egl_onscreen->egl_surface)
return;
eglMakeCurrent (egl_renderer->edpy,
egl_onscreen->egl_surface,
egl_onscreen->egl_surface,
egl_display->egl_context);
egl_context->current_surface = egl_onscreen->egl_surface;
if (fb->config.swap_throttled)
eglSwapInterval (egl_renderer->edpy, 1);
else
eglSwapInterval (egl_renderer->edpy, 0);
}
开发者ID:collects,项目名称:cogl,代码行数:25,代码来源:cogl-winsys-egl.c
示例10: flush_pending_resize
static void
flush_pending_resize (CoglOnscreen *onscreen)
{
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;
if (wayland_onscreen->has_pending)
{
wl_egl_window_resize (wayland_onscreen->wayland_egl_native_window,
wayland_onscreen->pending_width,
wayland_onscreen->pending_height,
wayland_onscreen->pending_dx,
wayland_onscreen->pending_dy);
_cogl_framebuffer_winsys_update_size (COGL_FRAMEBUFFER (onscreen),
wayland_onscreen->pending_width,
wayland_onscreen->pending_height);
_cogl_onscreen_queue_full_dirty (onscreen);
wayland_onscreen->pending_dx = 0;
wayland_onscreen->pending_dy = 0;
wayland_onscreen->has_pending = FALSE;
}
}
开发者ID:Distrotech,项目名称:cogl,代码行数:25,代码来源:cogl-winsys-egl-wayland.c
示例11: bind_onscreen_with_context
static CoglBool
bind_onscreen_with_context (CoglOnscreen *onscreen,
EGLContext egl_context)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = fb->context;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglBool status = _cogl_winsys_egl_make_current (context->display,
egl_onscreen->egl_surface,
egl_onscreen->egl_surface,
egl_context);
if (status)
{
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
if (fb->config.swap_throttled)
eglSwapInterval (egl_renderer->edpy, 1);
else
eglSwapInterval (egl_renderer->edpy, 0);
}
return status;
}
开发者ID:gcampax,项目名称:cogl,代码行数:25,代码来源:cogl-winsys-egl.c
示例12: cogl_wayland_onscreen_resize
void
cogl_wayland_onscreen_resize (CoglOnscreen *onscreen,
int width,
int height,
int offset_x,
int offset_y)
{
CoglFramebuffer *fb;
fb = COGL_FRAMEBUFFER (onscreen);
if (fb->allocated)
{
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;
if (cogl_framebuffer_get_width (fb) != width ||
cogl_framebuffer_get_height (fb) != height ||
offset_x ||
offset_y)
{
wayland_onscreen->pending_width = width;
wayland_onscreen->pending_height = height;
wayland_onscreen->pending_dx += offset_x;
wayland_onscreen->pending_dy += offset_y;
wayland_onscreen->has_pending = TRUE;
}
}
else
_cogl_framebuffer_winsys_update_size (fb, width, height);
}
开发者ID:collects,项目名称:cogl,代码行数:30,代码来源:cogl-winsys-egl-wayland.c
示例13: _cogl_winsys_egl_onscreen_init
static CoglBool
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
EGLConfig egl_config,
CoglError **error)
{
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglOnscreenWayland *wayland_onscreen;
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = framebuffer->context;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererWayland *wayland_renderer = egl_renderer->platform;
wayland_onscreen = g_slice_new0 (CoglOnscreenWayland);
egl_onscreen->platform = wayland_onscreen;
_cogl_list_init (&wayland_onscreen->frame_callbacks);
if (onscreen->foreign_surface)
wayland_onscreen->wayland_surface = onscreen->foreign_surface;
else
wayland_onscreen->wayland_surface =
wl_compositor_create_surface (wayland_renderer->wayland_compositor);
if (!wayland_onscreen->wayland_surface)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"Error while creating wayland surface for CoglOnscreen");
return FALSE;
}
wayland_onscreen->wayland_egl_native_window =
wl_egl_window_create (wayland_onscreen->wayland_surface,
cogl_framebuffer_get_width (framebuffer),
cogl_framebuffer_get_height (framebuffer));
if (!wayland_onscreen->wayland_egl_native_window)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"Error while creating wayland egl native window "
"for CoglOnscreen");
return FALSE;
}
egl_onscreen->egl_surface =
eglCreateWindowSurface (egl_renderer->edpy,
egl_config,
(EGLNativeWindowType)
wayland_onscreen->wayland_egl_native_window,
NULL);
if (!onscreen->foreign_surface)
wayland_onscreen->wayland_shell_surface =
wl_shell_get_shell_surface (wayland_renderer->wayland_shell,
wayland_onscreen->wayland_surface);
return TRUE;
}
开发者ID:Distrotech,项目名称:cogl,代码行数:59,代码来源:cogl-winsys-egl-wayland.c
示例14: cogl_android_onscreen_update_size
void
cogl_android_onscreen_update_size (CoglOnscreen *onscreen,
int width,
int height)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
_cogl_framebuffer_winsys_update_size (fb, width, height);
}
开发者ID:3v1n0,项目名称:cogl,代码行数:8,代码来源:cogl-winsys-egl-android.c
示例15: _cogl_winsys_onscreen_init
static CoglBool
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
CoglError **error)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = framebuffer->context;
CoglDisplay *display = context->display;
CoglDisplayEGL *egl_display = display->winsys;
CoglDisplayKMS *kms_display = egl_display->platform;
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererKMS *kms_renderer = egl_renderer->platform;
CoglOnscreenEGL *egl_onscreen;
CoglOnscreenKMS *kms_onscreen;
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE);
onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
egl_onscreen = onscreen->winsys;
kms_onscreen = g_slice_new0 (CoglOnscreenKMS);
egl_onscreen->platform = kms_onscreen;
kms_onscreen->surface =
gbm_surface_create (kms_renderer->gbm,
kms_display->width,
kms_display->height,
GBM_BO_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT |
GBM_BO_USE_RENDERING);
if (!kms_onscreen->surface)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"Failed to allocate surface");
return FALSE;
}
egl_onscreen->egl_surface =
eglCreateWindowSurface (egl_renderer->edpy,
egl_display->egl_config,
(NativeWindowType) kms_onscreen->surface,
NULL);
if (egl_onscreen->egl_surface == EGL_NO_SURFACE)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"Failed to allocate surface");
return FALSE;
}
_cogl_framebuffer_winsys_update_size (framebuffer,
kms_display->width,
kms_display->height);
return TRUE;
}
开发者ID:djdeath,项目名称:cogl-android,代码行数:58,代码来源:cogl-winsys-egl-kms.c
示例16: _cogl_winsys_onscreen_init
static CoglBool
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
CoglError **error)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = framebuffer->context;
CoglDisplay *display = context->display;
CoglDisplayEGL *egl_display = display->winsys;
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
EGLint attributes[MAX_EGL_CONFIG_ATTRIBS];
EGLConfig egl_config;
EGLint config_count = 0;
EGLBoolean status;
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE);
egl_attributes_from_framebuffer_config (display,
&framebuffer->config,
attributes);
status = eglChooseConfig (egl_renderer->edpy,
attributes,
&egl_config, 1,
&config_count);
if (status != EGL_TRUE || config_count == 0)
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
"Failed to find a suitable EGL configuration");
return FALSE;
}
/* Update the real number of samples_per_pixel now that we have
* found an egl_config... */
if (framebuffer->config.samples_per_pixel)
{
EGLint samples;
status = eglGetConfigAttrib (egl_renderer->edpy,
egl_config,
EGL_SAMPLES, &samples);
g_return_val_if_fail (status == EGL_TRUE, TRUE);
framebuffer->samples_per_pixel = samples;
}
onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
if (egl_renderer->platform_vtable->onscreen_init &&
!egl_renderer->platform_vtable->onscreen_init (onscreen,
egl_config,
error))
{
g_slice_free (CoglOnscreenEGL, onscreen->winsys);
return FALSE;
}
return TRUE;
}
开发者ID:gcampax,项目名称:cogl,代码行数:58,代码来源:cogl-winsys-egl.c
示例17: clutter_backend_win32_ensure_context
static void
clutter_backend_win32_ensure_context (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterStageWin32 *stage_win32 =
CLUTTER_STAGE_WIN32 (_clutter_stage_get_window (stage));
cogl_set_framebuffer (COGL_FRAMEBUFFER (stage_win32->onscreen));
}
开发者ID:spatulasnout,项目名称:clutter,代码行数:9,代码来源:clutter-backend-win32.c
示例18: bind_onscreen
static CoglBool
bind_onscreen (CoglOnscreen *onscreen)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = fb->context;
CoglDisplayEGL *egl_display = context->display->winsys;
return bind_onscreen_with_context (onscreen, egl_display->egl_context);
}
开发者ID:gcampax,项目名称:cogl,代码行数:9,代码来源:cogl-winsys-egl.c
示例19: _cogl_winsys_onscreen_swap_buffers
static void
_cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
{
CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
/* The specification for EGL (at least in 1.4) says that the surface
needs to be bound to the current context for the swap to work
although it may change in future. Mesa explicitly checks for this
and just returns an error if this is not the case so we can't
just pretend this isn't in the spec. */
_cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen),
COGL_FRAMEBUFFER (onscreen),
COGL_FRAMEBUFFER_STATE_BIND);
eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface);
}
开发者ID:collects,项目名称:cogl,代码行数:19,代码来源:cogl-winsys-egl.c
示例20: _cogl_winsys_onscreen_swap_buffers_with_damage
static void
_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles)
{
CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
/* The specification for EGL (at least in 1.4) says that the surface
needs to be bound to the current context for the swap to work
although it may change in future. Mesa explicitly checks for this
and just returns an error if this is not the case so we can't
just pretend this isn't in the spec. */
_cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen),
COGL_FRAMEBUFFER (onscreen),
COGL_FRAMEBUFFER_STATE_BIND);
if (n_rectangles && egl_renderer->pf_eglSwapBuffersWithDamage)
{
CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
size_t size = n_rectangles * sizeof (int) * 4;
int *flipped = alloca (size);
int i;
memcpy (flipped, rectangles, size);
for (i = 0; i < n_rectangles; i++)
{
const int *rect = rectangles + 4 * i;
int *flip_rect = flipped + 4 * i;
flip_rect[1] = fb->height - rect[1] - rect[3];
}
if (egl_renderer->pf_eglSwapBuffersWithDamage (egl_renderer->edpy,
egl_onscreen->egl_surface,
flipped,
n_rectangles) == EGL_FALSE)
g_warning ("Error reported by eglSwapBuffersWithDamage");
}
else
eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface);
}
开发者ID:gcampax,项目名称:cogl,代码行数:43,代码来源:cogl-winsys-egl.c
注:本文中的COGL_FRAMEBUFFER函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论