BsGLSupport.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. glGetError();
  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. for (INT32 i = 0; i < numExtensions; i++)
  26. extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
  27. }
  28. bool GLSupport::checkExtension(const String& ext) const
  29. {
  30. if(extensionList.find(ext) == extensionList.end())
  31. return false;
  32. return true;
  33. }
  34. }}