BsGLSupport.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsGLSupport.h"
  4. #include "BsGLTexture.h"
  5. #include "GL/glew.h"
  6. GLenum glewContextInit(bs::ct::GLSupport* glSupport);
  7. namespace bs { namespace ct
  8. {
  9. void GLSupport::initializeExtensions()
  10. {
  11. glewContextInit(this);
  12. BS_CHECK_GL_ERROR();
  13. // Set version string
  14. const GLubyte* pcVer = glGetString(GL_VERSION);
  15. assert(pcVer && "Problems getting GL version string using glGetString");
  16. String tmpStr = (const char*)pcVer;
  17. mVersion = tmpStr.substr(0, tmpStr.find(" "));
  18. // Get vendor
  19. const GLubyte* pcVendor = glGetString(GL_VENDOR);
  20. tmpStr = (const char*)pcVendor;
  21. mVendor = tmpStr.substr(0, tmpStr.find(" "));
  22. // Set extension list
  23. INT32 numExtensions = 0;
  24. glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
  25. BS_CHECK_GL_ERROR();
  26. for (INT32 i = 0; i < numExtensions; i++)
  27. extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
  28. }
  29. bool GLSupport::checkExtension(const String& ext) const
  30. {
  31. if(extensionList.find(ext) == extensionList.end())
  32. return false;
  33. return true;
  34. }
  35. }}