[cogl/wip/gles2-context] WIP: Add CoglGLES2Context



commit aff67a1dfa7bb3932953a5914cc93d984e93ff27
Author: Tomeu Vizoso <tomeu vizoso collabora com>
Date:   Tue Dec 6 17:18:41 2011 +0100

    WIP: Add CoglGLES2Context

 cogl/Makefile.am          |    2 +
 cogl/cogl-gles2-context.c |   67 +++++++++++++++++++++++++++++++++++++++++++++
 cogl/cogl-gles2-context.h |   59 +++++++++++++++++++++++++++++++++++++++
 cogl/cogl.h               |    1 +
 4 files changed, 129 insertions(+), 0 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 46a1a8c..5910043 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -101,6 +101,7 @@ cogl_experimental_h = \
 	$(srcdir)/cogl-onscreen-template.h 	\
 	$(srcdir)/cogl-display.h 		\
 	$(srcdir)/cogl-context.h 		\
+	$(srcdir)/cogl-gles2-context.h 		\
 	$(srcdir)/cogl-pipeline.h 		\
 	$(srcdir)/cogl-pipeline-state.h 	\
 	$(srcdir)/cogl-pipeline-layer-state.h 	\
@@ -329,6 +330,7 @@ cogl_sources_c = \
 	$(srcdir)/cogl-config.c				\
 	$(srcdir)/cogl-boxed-value.h			\
 	$(srcdir)/cogl-boxed-value.c			\
+	$(srcdir)/cogl-gles2-context.c			\
 	$(NULL)
 
 if SUPPORT_XLIB
diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
new file mode 100644
index 0000000..ca861a9
--- /dev/null
+++ b/cogl/cogl-gles2-context.c
@@ -0,0 +1,67 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * 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>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-gles2-context.h"
+#include "cogl-context-private.h"
+
+struct _CoglGLES2Context
+{
+    CoglContext *context;
+};
+
+CoglGLES2Context *
+cogl_gles2_context_new (CoglContext *ctx, GError **error)
+{
+  CoglGLES2Context *context = g_malloc (sizeof (CoglGLES2Context));
+
+  cogl_object_ref (ctx);
+  context->context = ctx;
+
+  return context;
+}
+
+CoglGLES2Vtable *
+cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx)
+{
+  CoglContext *ctx = gles2_ctx->context;
+  CoglGLES2Vtable *vtable = g_malloc (sizeof (CoglGLES2Vtable));
+
+  vtable->createShader = ctx->glCreateShader;
+
+  return vtable;
+}
+
+void
+cogl_gles2_framebuffer_push_context (CoglFramebuffer *framebuffer,
+                                     CoglGLES2Context *gles2_ctx,
+                                     GError **error)
+{
+
+}
diff --git a/cogl/cogl-gles2-context.h b/cogl/cogl-gles2-context.h
new file mode 100644
index 0000000..e8dd55a
--- /dev/null
+++ b/cogl/cogl-gles2-context.h
@@ -0,0 +1,59 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * 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>
+ *
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
+#ifndef __COGL_GLES2_CONTEXT_H__
+#define __COGL_GLES2_CONTEXT_H__
+
+#include <cogl/cogl-defines.h>
+#include <cogl/cogl-context.h>
+#include <cogl/cogl-framebuffer.h>
+
+G_BEGIN_DECLS
+
+typedef struct _CoglGLES2Context CoglGLES2Context;
+typedef struct _CoglGLES2Vtable CoglGLES2Vtable;
+
+struct _CoglGLES2Vtable
+{
+  GLuint (*createShader) (GLenum);
+};
+
+CoglGLES2Context *cogl_gles2_context_new (CoglContext *ctx, GError **error);
+
+CoglGLES2Vtable *cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx);
+
+void cogl_gles2_framebuffer_push_context (CoglFramebuffer *framebuffer,
+                                          CoglGLES2Context *gles2_ctx,
+                                          GError **error);
+
+G_END_DECLS
+
+#endif /* __COGL_GLES2_CONTEXT_H__ */
+
diff --git a/cogl/cogl.h b/cogl/cogl.h
index 0630a27..e8b846a 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -96,6 +96,7 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
 #include <cogl/cogl-pipeline-layer-state.h>
 #include <cogl/cogl-framebuffer.h>
 #include <cogl/cogl-onscreen.h>
+#include <cogl/cogl-gles2-context.h>
 #if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT)
 #include <cogl/cogl-wayland-renderer.h>
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]