mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
010d16f647
This makes it possible to integrate existing GLES2 code with applications using Cogl as the rendering api. Currently all GLES2 usage is handled with separate GLES2 contexts to ensure that GLES2 api usage doesn't interfere with Cogl's own use of OpenGL[ES]. The api has been designed though so we can provide tighter integration later. The api would allow us to support GLES2 virtualized on top of an OpenGL/GLX driver as well as GLES2 virtualized on the core rendering api of Cogl itself. Virtualizing the GLES2 support on Cogl will allow us to take advantage of Cogl debugging facilities as well as let us optimize the cost of allocating multiple GLES2 contexts and switching between them which can both be very expensive with many drivers. As as a side effect of this patch Cogl can also now be used as a portable window system binding API for GLES2 as an alternative to EGL. Parts of this patch are based on work done by Tomeu Vizoso <tomeu.vizoso@collabora.com> who did the first iteration of adding GLES2 API support to Cogl so that WebGL support could be added to webkit-clutter. This patch adds a very minimal cogl-gles2-context example that shows how to create a gles2 context, clear the screen to a random color and also draw a triangle with the cogl api. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 4bb6eff3dbd50d8fef7d6bdbed55c5aaa70036a8)
70 lines
1.8 KiB
C
70 lines
1.8 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2011 Collabora Ltd.
|
|
* Copyright (C) 2012 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Authors:
|
|
* Tomeu Vizoso <tomeu.vizoso@collabora.com>
|
|
* Robert Bragg <robert@linux.intel.com>
|
|
*
|
|
*/
|
|
|
|
#ifndef __COGL_GLES2_CONTEXT_PRIVATE_H
|
|
#define __COGL_GLES2_CONTEXT_PRIVATE_H
|
|
|
|
#include <glib.h>
|
|
|
|
#include "cogl-object-private.h"
|
|
#include "cogl-framebuffer-private.h"
|
|
#include "cogl-queue.h"
|
|
|
|
typedef struct _CoglGLES2Offscreen CoglGLES2Offscreen;
|
|
|
|
COGL_LIST_HEAD (CoglGLES2OffscreenList, CoglGLES2Offscreen);
|
|
|
|
struct _CoglGLES2Offscreen
|
|
{
|
|
COGL_LIST_ENTRY (CoglGLES2Offscreen) list_node;
|
|
CoglOffscreen *original_offscreen;
|
|
CoglGLFramebuffer gl_framebuffer;
|
|
};
|
|
|
|
struct _CoglGLES2Context
|
|
{
|
|
CoglObject _parent;
|
|
|
|
CoglContext *context;
|
|
|
|
CoglFramebuffer *read_buffer;
|
|
CoglGLES2Offscreen *gles2_read_buffer;
|
|
CoglFramebuffer *write_buffer;
|
|
CoglGLES2Offscreen *gles2_write_buffer;
|
|
|
|
GLuint current_fbo_handle;
|
|
|
|
CoglGLES2OffscreenList foreign_offscreens;
|
|
|
|
CoglGLES2Vtable *vtable;
|
|
|
|
void *winsys;
|
|
};
|
|
|
|
#endif /* __COGL_GLES2_CONTEXT_PRIVATE_H */
|