1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "BsGLSupport.h"
4#include "BsGLTexture.h"
5
6#if BS_PLATFORM != BS_PLATFORM_OSX
7#include "GL/glew.h"
8
9GLenum glewContextInit(bs::ct::GLSupport* glSupport);
10#endif
11
12namespace bs { namespace ct
13{
14 void GLSupport::initializeExtensions()
15 {
16#if BS_PLATFORM != BS_PLATFORM_OSX
17 glewContextInit(this);
18 BS_CHECK_GL_ERROR();
19#endif
20
21 // Set version string
22 const GLubyte* pcVer = glGetString(GL_VERSION);
23 assert(pcVer && "Problems getting GL version string using glGetString");
24
25 String tmpStr = (const char*)pcVer;
26 mVersion = tmpStr.substr(0, tmpStr.find(" "));
27
28 // Get vendor
29 const GLubyte* pcVendor = glGetString(GL_VENDOR);
30 tmpStr = (const char*)pcVendor;
31 mVendor = tmpStr.substr(0, tmpStr.find(" "));
32
33 // Set extension list
34 INT32 numExtensions = 0;
35 glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
36 BS_CHECK_GL_ERROR();
37
38 for (INT32 i = 0; i < numExtensions; i++)
39 extensionList.insert(String((char*)glGetStringi(GL_EXTENSIONS, i)));
40 }
41
42 bool GLSupport::checkExtension(const String& ext) const
43 {
44 if(extensionList.find(ext) == extensionList.end())
45 return false;
46
47 return true;
48 }
49}}