BsGLSupport.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "BsGLSupport.h"
  2. #include "BsGLTexture.h"
  3. #include "GL/glew.h"
  4. GLenum GLEWAPIENTRY glewContextInit(BansheeEngine::GLSupport *glSupport);
  5. namespace BansheeEngine
  6. {
  7. void GLSupport::initializeExtensions()
  8. {
  9. glewContextInit(this);
  10. // Set version string
  11. const GLubyte* pcVer = glGetString(GL_VERSION);
  12. assert(pcVer && "Problems getting GL version string using glGetString");
  13. String tmpStr = (const char*)pcVer;
  14. mVersion = tmpStr.substr(0, tmpStr.find(" "));
  15. // Get vendor
  16. const GLubyte* pcVendor = glGetString(GL_VENDOR);
  17. tmpStr = (const char*)pcVendor;
  18. mVendor = tmpStr.substr(0, tmpStr.find(" "));
  19. // Set extension list
  20. int numExtensions = 0;
  21. glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
  22. for (int i = 0; i < numExtensions; i++)
  23. {
  24. extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
  25. }
  26. }
  27. bool GLSupport::checkExtension(const String& ext) const
  28. {
  29. if(extensionList.find(ext) == extensionList.end())
  30. return false;
  31. return true;
  32. }
  33. }