From 0a9b08f93655756a53cbcaf5496ec5efcc302cb7 Mon Sep 17 00:00:00 2001 From: "gman@chromium.org" Date: Mon, 8 Mar 2010 18:20:10 +0000 Subject: 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 --- gpu/command_buffer/client/gles2_demo_cc.cc | 1 + gpu/command_buffer/common/GLES2/gl2.h | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'gpu/command_buffer') 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 #include 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 -#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_ */ -- cgit v1.1