OpenGL_Internal-ios.h 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. ===== IMPORTANT =====
  3. This is sample code demonstrating API, technology or techniques in development.
  4. Although this sample code has been reviewed for technical accuracy, it is not
  5. final. Apple is supplying this information to help you plan for the adoption of
  6. the technologies and programming interfaces described herein. This information
  7. is subject to change, and software implemented based on this sample code should
  8. be tested with final operating system software and final documentation. Newer
  9. versions of this sample code may be provided with future seeds of the API or
  10. technology. For information about updates to this and other developer
  11. documentation, view the New & Updated sidebars in subsequent documentation
  12. seeds.
  13. =====================
  14. File: OpenGL_Internal.h
  15. Abstract: This file is included for support purposes and isn't necessary for
  16. understanding this sample.
  17. Version: 1.0
  18. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
  19. ("Apple") in consideration of your agreement to the following terms, and your
  20. use, installation, modification or redistribution of this Apple software
  21. constitutes acceptance of these terms. If you do not agree with these terms,
  22. please do not use, install, modify or redistribute this Apple software.
  23. In consideration of your agreement to abide by the following terms, and subject
  24. to these terms, Apple grants you a personal, non-exclusive license, under
  25. Apple's copyrights in this original Apple software (the "Apple Software"), to
  26. use, reproduce, modify and redistribute the Apple Software, with or without
  27. modifications, in source and/or binary forms; provided that if you redistribute
  28. the Apple Software in its entirety and without modifications, you must retain
  29. this notice and the following text and disclaimers in all such redistributions
  30. of the Apple Software.
  31. Neither the name, trademarks, service marks or logos of Apple Inc. may be used
  32. to endorse or promote products derived from the Apple Software without specific
  33. prior written permission from Apple. Except as expressly stated in this notice,
  34. no other rights or licenses, express or implied, are granted by Apple herein,
  35. including but not limited to any patent rights that may be infringed by your
  36. derivative works or by other works in which the Apple Software may be
  37. incorporated.
  38. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
  39. WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  40. WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  41. PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  42. COMBINATION WITH YOUR PRODUCTS.
  43. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  44. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  45. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  46. ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
  47. DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
  48. CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
  49. APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  50. Copyright (C) 2008 Apple Inc. All Rights Reserved.
  51. */
  52. #include "platform/CCPlatformConfig.h"
  53. #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
  54. /* Generic error reporting */
  55. #define REPORT_ERROR(__FORMAT__, ...) printf("%s: %s\n", __FUNCTION__, [[NSString stringWithFormat:__FORMAT__, __VA_ARGS__] UTF8String])
  56. /* EAGL and GL functions calling wrappers that log on error */
  57. #define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? NO : YES); })
  58. //#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); (__error ? NO : YES); })
  59. #define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s %d\n", __error, __FUNCTION__, __LINE__); })
  60. /* Optional delegate methods support */
  61. #ifndef __DELEGATE_IVAR__
  62. #define __DELEGATE_IVAR__ _delegate
  63. #endif
  64. #ifndef __DELEGATE_METHODS_IVAR__
  65. #define __DELEGATE_METHODS_IVAR__ _delegateMethods
  66. #endif
  67. #define TEST_DELEGATE_METHOD_BIT(__BIT__) (self->__DELEGATE_METHODS_IVAR__ & (1 << __BIT__))
  68. #define SET_DELEGATE_METHOD_BIT(__BIT__, __NAME__) { if([self->__DELEGATE_IVAR__ respondsToSelector:@selector(__NAME__)]) self->__DELEGATE_METHODS_IVAR__ |= (1 << __BIT__); else self->__DELEGATE_METHODS_IVAR__ &= ~(1 << __BIT__); }
  69. #endif // CC_PLATFORM_IOS