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. glGetError();
  11. // Set version string
  12. const GLubyte* pcVer = glGetString(GL_VERSION);
  13. assert(pcVer && "Problems getting GL version string using glGetString");
  14. String tmpStr = (const char*)pcVer;
  15. mVersion = tmpStr.substr(0, tmpStr.find(" "));
  16. // Get vendor
  17. const GLubyte* pcVendor = glGetString(GL_VENDOR);
  18. tmpStr = (const char*)pcVendor;
  19. mVendor = tmpStr.substr(0, tmpStr.find(" "));
  20. // Set extension list
  21. int numExtensions = 0;
  22. glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
  23. for (int i = 0; i < numExtensions; i++)
  24. {
  25. extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
  26. }
  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. }