BsGLSupport.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #include "BsGLSupport.h"
  5. #include "BsGLTexture.h"
  6. #include "GL/glew.h"
  7. GLenum GLEWAPIENTRY glewContextInit(BansheeEngine::GLSupport *glSupport);
  8. namespace BansheeEngine
  9. {
  10. void GLSupport::initializeExtensions()
  11. {
  12. glewContextInit(this);
  13. glGetError();
  14. // Set version string
  15. const GLubyte* pcVer = glGetString(GL_VERSION);
  16. assert(pcVer && "Problems getting GL version string using glGetString");
  17. String tmpStr = (const char*)pcVer;
  18. mVersion = tmpStr.substr(0, tmpStr.find(" "));
  19. // Get vendor
  20. const GLubyte* pcVendor = glGetString(GL_VENDOR);
  21. tmpStr = (const char*)pcVendor;
  22. mVendor = tmpStr.substr(0, tmpStr.find(" "));
  23. // Set extension list
  24. int numExtensions = 0;
  25. glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
  26. for (int i = 0; i < numExtensions; i++)
  27. {
  28. extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
  29. }
  30. }
  31. bool GLSupport::checkExtension(const String& ext) const
  32. {
  33. if(extensionList.find(ext) == extensionList.end())
  34. return false;
  35. return true;
  36. }
  37. }