/* ** GLimp_InitGL */ static bool GLimp_InitGL( void ) { int format; EGLConfig config; const int pbufferAttribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE }; const int contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; EGLSurface surface; glw_state.display = qeglGetDisplay( EGL_DEFAULT_DISPLAY ); if( glw_state.display == EGL_NO_DISPLAY ) { ri.Com_Printf( "GLimp_InitGL() - eglGetDisplay failed\n" ); return false; } if( !qeglInitialize( glw_state.display, NULL, NULL ) ) { ri.Com_Printf( "GLimp_InitGL() - eglInitialize failed\n" ); return false; } GLimp_Android_ChooseConfig(); if( !glw_state.config ) { ri.Com_Printf( "GLimp_InitGL() - GLimp_Android_ChooseConfig failed\n" ); return false; } if ( !qeglGetConfigAttrib( glw_state.display, glw_state.config, EGL_NATIVE_VISUAL_ID, &glw_state.format ) ) { ri.Com_Printf( "GLimp_InitGL() - eglGetConfigAttrib failed\n" ); return false; } glw_state.pbufferSurface = qeglCreatePbufferSurface( glw_state.display, glw_state.config, pbufferAttribs ); if( glw_state.pbufferSurface == EGL_NO_SURFACE ) { ri.Com_Printf( "GLimp_InitGL() - eglCreatePbufferSurface failed\n" ); return false; } glw_state.context = qeglCreateContext( glw_state.display, glw_state.config, EGL_NO_CONTEXT, contextAttribs ); if( glw_state.context == EGL_NO_CONTEXT ) { ri.Com_Printf( "GLimp_InitGL() - eglCreateContext failed\n" ); return false; } glw_state.swapInterval = 1; GLimp_Android_UpdateWindowSurface(); return true; }
/* ** GLimp_InitGL */ static bool GLimp_InitGL( void ) { int format; EGLConfig config; const int contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; EGLSurface surface; glw_state.display = qeglGetDisplay( EGL_DEFAULT_DISPLAY ); if( glw_state.display == EGL_NO_DISPLAY ) { ri.Com_Printf( "GLimp_InitGL() - eglGetDisplay failed\n" ); return false; } if( !qeglInitialize( glw_state.display, NULL, NULL ) ) { ri.Com_Printf( "GLimp_InitGL() - eglInitialize failed\n" ); return false; } GLimp_EGL_ChooseConfig(); if( !glw_state.config ) { ri.Com_Printf( "GLimp_InitGL() - GLimp_EGL_ChooseConfig failed\n" ); return false; } if ( !qeglGetConfigAttrib( glw_state.display, glw_state.config, EGL_NATIVE_VISUAL_ID, &glw_state.format ) ) { ri.Com_Printf( "GLimp_InitGL() - eglGetConfigAttrib failed\n" ); return false; } glw_state.mainThreadPbuffer = GLimp_EGL_CreatePbufferSurface(); if( glw_state.mainThreadPbuffer == EGL_NO_SURFACE ) { ri.Com_Printf( "GLimp_InitGL() - GLimp_EGL_CreatePbufferSurface for mainThreadPbuffer failed\n" ); return false; } glw_state.noWindowPbuffer = GLimp_EGL_CreatePbufferSurface(); if( glw_state.noWindowPbuffer == EGL_NO_SURFACE ) { ri.Com_Printf( "GLimp_InitGL() - GLimp_EGL_CreatePbufferSurface for noWindowPbuffer failed\n" ); return false; } glw_state.context = qeglCreateContext( glw_state.display, glw_state.config, EGL_NO_CONTEXT, contextAttribs ); if( glw_state.context == EGL_NO_CONTEXT ) { ri.Com_Printf( "GLimp_InitGL() - eglCreateContext failed\n" ); return false; } glw_state.windowMutex = ri.Mutex_Create(); glw_state.swapInterval = 1; // Default swap interval for new surfaces // GLimp_EGL_UpdateWindowSurface attaches the surface to the current context, so make one current to initialize qeglMakeCurrent( glw_state.display, glw_state.noWindowPbuffer, glw_state.noWindowPbuffer, glw_state.context ); GLimp_EGL_UpdateWindowSurface(); return true; }