summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 18:20:10 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 18:20:10 +0000
commit0a9b08f93655756a53cbcaf5496ec5efcc302cb7 (patch)
treed81180806970eae6a5e9fa06f667049f3b3101df
parentdf4370a438b17411b818d779253687a7cd2bcd8f (diff)
downloadchromium_src-0a9b08f93655756a53cbcaf5496ec5efcc302cb7.zip
chromium_src-0a9b08f93655756a53cbcaf5496ec5efcc302cb7.tar.gz
chromium_src-0a9b08f93655756a53cbcaf5496ec5efcc302cb7.tar.bz2
Change gl2.h to default to C bindings
This is a smaller change than rearranging the files under gpu. That will be the next step. TEST=none BUG=none Review URL: http://codereview.chromium.org/669258 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40909 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/client/gles2_demo_cc.cc1
-rw-r--r--gpu/command_buffer/common/GLES2/gl2.h28
-rw-r--r--gpu/demos/gles2_book/example.h1
3 files changed, 26 insertions, 4 deletions
diff --git a/gpu/command_buffer/client/gles2_demo_cc.cc b/gpu/command_buffer/client/gles2_demo_cc.cc
index d5cbbdd..43115ef 100644
--- a/gpu/command_buffer/client/gles2_demo_cc.cc
+++ b/gpu/command_buffer/client/gles2_demo_cc.cc
@@ -6,6 +6,7 @@
// includes where appropriate.
#include "gpu/command_buffer/client/gles2_demo_cc.h"
+#include "gpu/command_buffer/common/logging.h"
#include <math.h>
#include <GLES2/gl2.h>
diff --git a/gpu/command_buffer/common/GLES2/gl2.h b/gpu/command_buffer/common/GLES2/gl2.h
index 6293ee4..4ce0d7c 100644
--- a/gpu/command_buffer/common/GLES2/gl2.h
+++ b/gpu/command_buffer/common/GLES2/gl2.h
@@ -10,8 +10,20 @@
#include <GLES2/gl2types.h>
-#ifdef __cplusplus
-#include "gpu/command_buffer/client/gles2_lib.h"
+// Note: If your program is written in C++ you can define
+// GLES2_INLINE_OPTIMIZATION to get an inline version of the OpenGL ES 2.0
+// code for your program. The advantage is a program compiled with high
+// optimization settings can generate very efficient code for issuing OpenGL ES
+// commands. The disadvantage is there is a small possibility of conflicts with
+// your code as we need to include lots of class definitions and a few
+// macros.
+
+#if defined(__cplusplus) && defined(GLES2_INLINE_OPTIMIZATION)
+#include "gpu/command_buffer/command_buffer/client/gles2_lib.h"
+#define GLES2_USE_CPP_BINDINGS
+#endif
+
+#if defined(GLES2_USE_CPP_BINDINGS)
#define GLES2_GET_FUN(name) gles2::GetGLContext()->name
#else
#define GLES2_GET_FUN(name) GLES2 ## name
@@ -168,7 +180,11 @@
#define glVertexAttribPointer GLES2_GET_FUN(VertexAttribPointer)
#define glViewport GLES2_GET_FUN(Viewport)
-#ifndef __cplusplus
+#if !defined(GLES2_USE_CPP_BINDINGS)
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
@@ -313,7 +329,11 @@ GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif // __cplusplus
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // !GLES2_USE_CPP_BINDINGS
#endif /* __gl2_h_ */
diff --git a/gpu/demos/gles2_book/example.h b/gpu/demos/gles2_book/example.h
index 5facbdd..38711a7 100644
--- a/gpu/demos/gles2_book/example.h
+++ b/gpu/demos/gles2_book/example.h
@@ -7,6 +7,7 @@
#ifndef GPU_DEMOS_GLES2_BOOK_EXAMPLE_H_
#define GPU_DEMOS_GLES2_BOOK_EXAMPLE_H_
+#include "gpu/command_buffer/common/logging.h"
#include "gpu/demos/framework/demo.h"
#include "third_party/gles2_book/Common/Include/esUtil.h"