glew-mx.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version 2
  5. * of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software Foundation,
  14. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. *
  16. * The Original Code is Copyright (C) 2014 Blender Foundation.
  17. * All rights reserved.
  18. */
  19. /** \file
  20. * \ingroup glew-mx
  21. *
  22. * Support for GLEW Multiple rendering conteXts (MX)
  23. * Maintained as a Blender Library.
  24. *
  25. * Different rendering contexts may have different entry points
  26. * to extension functions of the same name. So it can cause
  27. * problems if, for example, a second context uses a pointer to
  28. * say, glActiveTextureARB, that was queried from the first context.
  29. *
  30. * GLEW has basic support for multiple contexts by enabling WITH_GLEW_MX,
  31. * but it does not provide a full implementation. This is because
  32. * there are too many questions about thread safety and memory
  33. * allocation that are up to the user of GLEW.
  34. *
  35. * This implementation is very basic and isn't thread safe.
  36. * For a single context the overhead should be
  37. * no more than using GLEW without WITH_GLEW_MX enabled.
  38. */
  39. #ifndef __GLEW_MX_H__
  40. #define __GLEW_MX_H__
  41. #include <GL/glew.h>
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. #include "intern/symbol-binding.h"
  46. /* If compiling only for OpenGL 3.2 Core Profile then we should make sure
  47. * no legacy API entries or symbolic constants are used.
  48. */
  49. #if (!defined(WITH_LEGACY_OPENGL)) || defined(WITH_GL_PROFILE_CORE) && \
  50. !defined(WITH_GL_PROFILE_COMPAT) && \
  51. !defined(WITH_GL_PROFILE_ES20)
  52. # include "intern/gl-deprecated.h"
  53. #endif
  54. GLenum glew_chk(GLenum error, const char *file, int line, const char *text);
  55. #ifndef NDEBUG
  56. # define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, # x)
  57. #else
  58. # define GLEW_CHK(x) glew_chk((x), NULL, 0, NULL)
  59. #endif
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* __GLEW_MX_H__ */