MCPcopy Create free account
hub / github.com/crownengine/crown / create

Method create

3rdparty/bgfx/src/glcontext_egl.cpp:244–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242# endif // BX_PLATFORM_RPI
243
244 void GlContext::create(const Resolution& _resolution)
245 {
246# if BX_PLATFORM_RPI
247 bcm_host_init();
248# endif // BX_PLATFORM_RPI
249
250 m_eglDll = eglOpen();
251
252 if (NULL == g_platformData.context)
253 {
254# if BX_PLATFORM_RPI
255 g_platformData.ndt = EGL_DEFAULT_DISPLAY;
256# endif // BX_PLATFORM_RPI
257
258 EGLNativeDisplayType ndt = (EGLNativeDisplayType)g_platformData.ndt;
259 EGLNativeWindowType nwh = (EGLNativeWindowType )g_platformData.nwh;
260
261# if BX_PLATFORM_WINDOWS
262 if (NULL == g_platformData.ndt)
263 {
264 ndt = GetDC( (HWND)g_platformData.nwh);
265 }
266# endif // BX_PLATFORM_WINDOWS
267
268 m_display = eglGetDisplay(NULL == ndt ? EGL_DEFAULT_DISPLAY : ndt);
269 BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
270
271 EGLint major = 0;
272 EGLint minor = 0;
273 EGLBoolean success = eglInitialize(m_display, &major, &minor);
274 BGFX_FATAL(success && major >= 1 && minor >= 3, Fatal::UnableToInitialize, "Failed to initialize %d.%d", major, minor);
275
276 BX_TRACE("EGL info:");
277 const char* clientApis = eglQueryString(m_display, EGL_CLIENT_APIS);
278 BX_TRACE(" APIs: %s", clientApis); BX_UNUSED(clientApis);
279
280 const char* vendor = eglQueryString(m_display, EGL_VENDOR);
281 BX_TRACE(" Vendor: %s", vendor); BX_UNUSED(vendor);
282
283 const char* version = eglQueryString(m_display, EGL_VERSION);
284 BX_TRACE("Version: %s", version); BX_UNUSED(version);
285
286 const char* extensions = eglQueryString(m_display, EGL_EXTENSIONS);
287 BX_TRACE("Supported EGL extensions:");
288 dumpExtensions(extensions);
289
290 if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
291 {
292 EGLBoolean ok = eglBindAPI(EGL_OPENGL_API);
293 BGFX_FATAL(ok, Fatal::UnableToInitialize, "Could not set API! error: %d", eglGetError());
294 }
295
296 const bool hasEglAndroidRecordable = !bx::findIdentifierMatch(extensions, "EGL_ANDROID_recordable").isEmpty();
297
298 const uint32_t glVersion = !!BGFX_CONFIG_RENDERER_OPENGL
299 ? BGFX_CONFIG_RENDERER_OPENGL
300 : BGFX_CONFIG_RENDERER_OPENGLES
301 ;

Callers

nothing calls this directly

Calls 9

eglOpenFunction · 0.85
findIdentifierMatchFunction · 0.85
waylandEglOpenFunction · 0.85
dumpExtensionsFunction · 0.70
EnumEnum · 0.70
writeFunction · 0.70
maxFunction · 0.50
minFunction · 0.50
isEmptyMethod · 0.45

Tested by

no test coverage detected