///////////////////////////////////////////////////////
| 179 | |
| 180 | //////////////////////////////////////////////////////////// |
| 181 | GlFunctionPointer 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 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected