JNIEXPORT void JNICALL Java_com_showtimemediacenter_showtime_STCore_glwInit(JNIEnv *env, jobject obj, jint id) { android_glw_root_t *agr = (android_glw_root_t *)id; TRACE(TRACE_DEBUG, "GLW", "GLW %p initialied", agr); agr->agr_running = 1; glw_opengl_init_context(&agr->gr); glClearColor(0,0,0,0); }
static void init_ui(void *data, int flags) { nacl_glw_root_t *ngr = data; initialized |= flags; if(!(initialized & CORE_INITIALIZED)) return; if(ngr->gr.gr_width == 0 || ngr->gr.gr_height == 0) return; if(nacl_3d_context) { ppb_graphics3d->ResizeBuffers(nacl_3d_context, ngr->gr.gr_width, ngr->gr.gr_height); return; } const int32_t attrib_list[] = { PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, PP_GRAPHICS3DATTRIB_WIDTH, ngr->gr.gr_width, PP_GRAPHICS3DATTRIB_HEIGHT, ngr->gr.gr_height, PP_GRAPHICS3DATTRIB_NONE }; nacl_3d_context = ppb_graphics3d->Create(g_Instance, 0, attrib_list); if(nacl_3d_context == 0) { panic("Unable to create 3D-graphics context"); return; } if(!ppb_instance->BindGraphics(g_Instance, nacl_3d_context)) { panic("Unable to bind 3D-graphics context"); return; } glSetCurrentContextPPAPI(nacl_3d_context); TRACE(TRACE_DEBUG, "NACL", "Current 3d context set"); glw_opengl_init_context(&ngr->gr); glClearColor(0,0,0,1); send_msg("running", NULL); mainloop(ngr); }
static int window_open(glw_x11_t *gx11, int fullscreen) { XSetWindowAttributes winAttr; unsigned long mask; XTextProperty text; char buf[60]; int fevent, x, y, w, h; winAttr.event_mask = KeyPressMask | KeyReleaseMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask; winAttr.background_pixmap = None; winAttr.background_pixel = 0; winAttr.border_pixel = 0; winAttr.colormap = gx11->colormap = XCreateColormap(gx11->display, gx11->root, gx11->xvi->visual, AllocNone); mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask; if(fullscreen) { x = 0; y = 0; w = gx11->screen_width; h = gx11->screen_height; winAttr.override_redirect = True; mask |= CWOverrideRedirect; } else { x = gx11->screen_width / 4; y = gx11->screen_height / 4; w = gx11->req_width ?: 853; h = gx11->req_height ?: 480; } gx11->win = XCreateWindow(gx11->display, gx11->root, x, y, w, h, 0, gx11->xvi->depth, InputOutput, gx11->xvi->visual, mask, &winAttr ); gx11->gr.gr_width = w; gx11->gr.gr_height = h; gx11->glxctx = glXCreateContext(gx11->display, gx11->xvi, NULL, 1); if(gx11->glxctx == NULL) { TRACE(TRACE_ERROR, "GLW", "Unable to create GLX context on \"%s\"\n", gx11->displayname_real); return 1; } glXMakeCurrent(gx11->display, gx11->win, gx11->glxctx); XMapWindow(gx11->display, gx11->win); /* Set window title */ snprintf(buf, sizeof(buf), "Showtime"); text.value = (unsigned char *)buf; text.encoding = XA_STRING; text.format = 8; text.nitems = strlen(buf); XSetWMName(gx11->display, gx11->win, &text); /* Create the window deletion atom */ XSetWMProtocols(gx11->display, gx11->win, &gx11->atom_deletewindow, 1); if(fullscreen) fullscreen_grab(gx11); glw_opengl_init_context(&gx11->gr); if(gx11->glXSwapIntervalSGI != NULL && gx11->force_no_vsync ==0) gx11->glXSwapIntervalSGI(1); gx11->working_vsync = check_vsync(gx11); if(!gx11->working_vsync) { if(strstr((const char *)glGetString(GL_VENDOR) ?: "", "NVIDIA")) { TRACE(TRACE_ERROR, "GLW", "OpenGL on \"%s\" does not sync to vertical blank.\n" "This is required for Showtime's OpenGL interface to\n" "function property. Please fix this.\n", gx11->displayname_real); return 1; } TRACE(TRACE_INFO, "GLW", "OpenGL driver does not provide adequate vertical sync " "capabilities. Using soft timers"); } hide_cursor(gx11); /* X Input method init */ if(gx11->im != NULL) { gx11->ic = XCreateIC(gx11->im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, gx11->win, NULL); XGetICValues(gx11->ic, XNFilterEvents, &fevent, NULL); XSelectInput(gx11->display, gx11->win, fevent | winAttr.event_mask); } else { TRACE(TRACE_INFO, "GLW", "Unable to enable keyboard input compositioning"); } return 0; }