CCGL-android.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /****************************************************************************
  2. Copyright (c) 2010-2012 cocos2d-x.org
  3. Copyright (c) 2013-2017 Chukong Technologies Inc.
  4. http://www.cocos2d-x.org
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. ****************************************************************************/
  21. #ifndef __CCGL_H__
  22. #define __CCGL_H__
  23. #include "platform/CCPlatformConfig.h"
  24. #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
  25. #define glClearDepth glClearDepthf
  26. #define glDeleteVertexArrays glDeleteVertexArraysOES
  27. #define glGenVertexArrays glGenVertexArraysOES
  28. #define glBindVertexArray glBindVertexArrayOES
  29. #define glMapBuffer glMapBufferOES
  30. #define glUnmapBuffer glUnmapBufferOES
  31. #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
  32. #define GL_WRITE_ONLY GL_WRITE_ONLY_OES
  33. // GL_GLEXT_PROTOTYPES isn't defined in glplatform.h on android ndk r7
  34. // we manually define it here
  35. #include <GLES2/gl2platform.h>
  36. #ifndef GL_GLEXT_PROTOTYPES
  37. #define GL_GLEXT_PROTOTYPES 1
  38. #endif
  39. // normal process
  40. #include <GLES2/gl2.h>
  41. #include <GLES2/gl2ext.h>
  42. // gl2.h doesn't define GLchar on Android
  43. typedef char GLchar;
  44. // android defines GL_BGRA_EXT but not GL_BRGA
  45. #ifndef GL_BGRA
  46. #define GL_BGRA 0x80E1
  47. #endif
  48. //declare here while define in EGLView_android.cpp
  49. extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOESEXT;
  50. extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOESEXT;
  51. extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOESEXT;
  52. #define glGenVertexArraysOES glGenVertexArraysOESEXT
  53. #define glBindVertexArrayOES glBindVertexArrayOESEXT
  54. #define glDeleteVertexArraysOES glDeleteVertexArraysOESEXT
  55. #endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
  56. #endif // __CCGL_H__