BsGLPrerequisites.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #if BS_THREAD_SUPPORT == 1
  6. # define GLEW_MX
  7. #endif
  8. // 4.1 is the minimum supported version for OpenGL
  9. #define BS_OPENGL_4_1 1
  10. #define BS_OPENGL_4_2 1
  11. #define BS_OPENGL_4_3 1
  12. #define BS_OPENGL_4_4 1
  13. #define BS_OPENGL_4_5 1
  14. #define BS_OPENGL_4_6 0
  15. // 3.1 is the minimum supported version for OpenGL ES
  16. #define BS_OPENGLES_3_1 0
  17. #define BS_OPENGLES_3_2 0
  18. #if BS_PLATFORM == BS_PLATFORM_WIN32
  19. #if !defined( __MINGW32__ )
  20. # define WIN32_LEAN_AND_MEAN
  21. # ifndef NOMINMAX
  22. # define NOMINMAX // required to stop windows.h messing up std::min
  23. # endif
  24. #endif
  25. # include <windows.h>
  26. # include <wingdi.h>
  27. # include <GL/glew.h>
  28. # include <GL/wglew.h>
  29. #elif BS_PLATFORM == BS_PLATFORM_LINUX
  30. # include <GL/glew.h>
  31. # include <GL/glu.h>
  32. # define GL_GLEXT_PROTOTYPES
  33. #elif BS_PLATFORM == BS_PLATFORM_OSX
  34. # include <GL/glew.h>
  35. #endif
  36. #if BS_THREAD_SUPPORT == 1
  37. GLEWContext * glewGetContext();
  38. # if BS_PLATFORM == BS_PLATFORM_WIN32
  39. WGLEWContext * wglewGetContext();
  40. # endif
  41. #endif
  42. // Lots of generated code in here which triggers the new VC CRT security warnings
  43. #if !defined( _CRT_SECURE_NO_DEPRECATE )
  44. #define _CRT_SECURE_NO_DEPRECATE
  45. #endif
  46. /** @addtogroup Plugins
  47. * @{
  48. */
  49. /** @defgroup GL BansheeGLRenderAPI
  50. * Wrapper around the OpenGL render API.
  51. */
  52. /** @} */
  53. namespace bs { namespace ct
  54. {
  55. /** Translated an OpenGL error code enum to an error code string. */
  56. const char* bs_get_gl_error_string(GLenum errorCode);
  57. /** Checks if there have been any OpenGL errors since the last call, and if so reports them. */
  58. void bs_check_gl_error(const char* function, const char* file, INT32 line);
  59. #if BS_DEBUG_MODE && (!BS_OPENGL_4_3 && !BS_OPENGLES_3_2)
  60. #define BS_CHECK_GL_ERROR() bs_check_gl_error(__PRETTY_FUNCTION__, __FILE__,__LINE__)
  61. #else
  62. #define BS_CHECK_GL_ERROR()
  63. #endif
  64. extern const char* MODULE_NAME;
  65. class GLSupport;
  66. class GLRenderAPI;
  67. class GLTexture;
  68. class GLVertexBuffer;
  69. class GLContext;
  70. class GLRTTManager;
  71. class GLPixelBuffer;
  72. class GLGpuParamBlock;
  73. class GLSLGpuProgram;
  74. class GLVertexArrayObject;
  75. struct GLSLProgramPipeline;
  76. class GLSLProgramPipelineManager;
  77. class GLTextureView;
  78. /** @addtogroup GL
  79. * @{
  80. */
  81. /** OpenGL specific types to track resource statistics for. */
  82. enum GLRenderStatResourceType
  83. {
  84. RenderStatObject_PipelineObject = 100,
  85. RenderStatObject_FrameBufferObject,
  86. RenderStatObject_VertexArrayObject
  87. };
  88. /** @} */
  89. }}