MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / getGLCapabilities

Function getGLCapabilities

engine/source/platformEmscripten/EmscriptenGL.cpp:48–234  ·  view source on GitHub ↗

Find out which extensions are available for this renderer.

Source from the content-addressed store, hash-verified

46
47// Find out which extensions are available for this renderer.
48void getGLCapabilities( )
49{
50 AssertFatal(platState.engine, "getGLCapabilities() was called before a monitor was chosen!");
51
52 // silently create an opengl context on the current display,
53 // so that we can get valid renderer and capability info.
54 // we save off the current context so that we can silently restore it.
55 // the user should not be aware of this little shuffle.
56 //CGLContextObj curr_ctx = CGLGetCurrentContext ();
57 //CGLContextObj temp_ctx = getContextForCapsCheck();
58 /*
59 if(!temp_ctx)
60 {
61 Con::errorf("OpenGL may not be set up correctly!");
62 return;
63 }
64 */
65 //CGLSetCurrentContext(temp_ctx);
66
67 // Get the OpenGL info strings we'll need
68 const char* pVendString = (const char*) glGetString( GL_VENDOR );
69 const char* pRendString = (const char*) glGetString( GL_RENDERER );
70 const char* pVersString = (const char*) glGetString( GL_VERSION );
71 const char* pExtString = (const char*) glGetString( GL_EXTENSIONS );
72
73 // Output some driver info to the console:
74 Con::printf( "OpenGL driver information:" );
75 if ( pVendString )
76 Con::printf( " Vendor: %s", pVendString );
77 if ( pRendString )
78 Con::printf( " Renderer: %s", pRendString );
79 if ( pVersString )
80 Con::printf( " Version: %s", pVersString );
81
82 // pre-clear the structure
83 dMemset(&gGLState, 0, sizeof(gGLState));
84
85 if(pExtString)
86 {
87 // EXT_paletted_texture ========================================
88 if (dStrstr(pExtString, (const char*)"GL_EXT_paletted_texture") != NULL)
89 gGLState.suppPalettedTexture = true;
90
91 // EXT_compiled_vertex_array ========================================
92 gGLState.suppLockedArrays = false;
93 if (dStrstr(pExtString, (const char*)"GL_EXT_compiled_vertex_array") != NULL)
94 gGLState.suppLockedArrays = true;
95
96 // ARB_multitexture ========================================
97 if (dStrstr(pExtString, (const char*)"GL_ARB_multitexture") != NULL)
98 gGLState.suppARBMultitexture = true;
99
100 // EXT_blend_color
101 if(dStrstr(pExtString, (const char*)"GL_EXT_blend_color") != NULL)
102 gGLState.suppEXTblendcolor = true;
103
104 // EXT_blend_minmax
105 if(dStrstr(pExtString, (const char*)"GL_EXT_blend_minmax") != NULL)

Callers 1

activateMethod · 0.70

Calls 7

printfFunction · 0.85
warnfFunction · 0.85
setBoolVariableFunction · 0.85
getBoolVariableFunction · 0.85
getIntVariableFunction · 0.85
dMemsetFunction · 0.70
dStrstrFunction · 0.70

Tested by

no test coverage detected