MCPcopy Create free account
hub / github.com/SFML/SFML / getFunction

Method getFunction

src/SFML/Window/Win32/WglContext.cpp:181–202  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

179
180////////////////////////////////////////////////////////////
181GlFunctionPointer WglContext::getFunction(const char* name)
182{
183 if (WglContextImpl::currentContext == nullptr)
184 return nullptr;
185
186 // If we are using the generic GDI implementation, skip to loading directly from OpenGL32.dll since it doesn't support extensions
187 if (!WglContextImpl::currentContext->m_isGeneric)
188 {
189 auto address = reinterpret_cast<GlFunctionPointer>(wglGetProcAddress(reinterpret_cast<LPCSTR>(name)));
190
191 if (address)
192 {
193 // Test whether the returned value is a valid error code
194 auto errorCode = reinterpret_cast<std::ptrdiff_t>(address);
195
196 if ((errorCode != -1) && (errorCode != 1) && (errorCode != 2) && (errorCode != 3))
197 return address;
198 }
199 }
200
201 return WglContextImpl::getOpenGl32Function(name);
202}
203
204
205////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

getOpenGl32FunctionFunction · 0.85

Tested by

no test coverage detected