void gd_egl_draw(VirtualConsole *vc) { GdkWindow *window; int ww, wh; if (!vc->gfx.gls) { return; } window = gtk_widget_get_window(vc->gfx.drawing_area); ww = gdk_window_get_width(window); wh = gdk_window_get_height(window); if (vc->gfx.scanout_mode) { gd_egl_scanout_flush(&vc->gfx.dcl, 0, 0, vc->gfx.w, vc->gfx.h); vc->gfx.scale_x = (double)ww / vc->gfx.w; vc->gfx.scale_y = (double)wh / vc->gfx.h; } else { if (!vc->gfx.ds) { return; } eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, vc->gfx.esurface, vc->gfx.ectx); surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); eglSwapBuffers(qemu_egl_display, vc->gfx.esurface); vc->gfx.scale_x = (double)ww / surface_width(vc->gfx.ds); vc->gfx.scale_y = (double)wh / surface_height(vc->gfx.ds); } }
void gd_egl_draw(VirtualConsole *vc) { GdkWindow *window; int ww, wh; if (!vc->gfx.gls) { return; } if (vc->gfx.scanout_mode) { gd_egl_scanout_flush(&vc->gfx.dcl, 0, 0, vc->gfx.w, vc->gfx.h); } else { if (!vc->gfx.ds) { return; } eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, vc->gfx.esurface, vc->gfx.ectx); window = gtk_widget_get_window(vc->gfx.drawing_area); gdk_drawable_get_size(window, &ww, &wh); surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); eglSwapBuffers(qemu_egl_display, vc->gfx.esurface); } }
static void sdl2_gl_render_surface(struct sdl2_console *scon) { int ww, wh; SDL_GL_MakeCurrent(scon->real_window, scon->winctx); sdl2_set_scanout_mode(scon, false); SDL_GetWindowSize(scon->real_window, &ww, &wh); surface_gl_setup_viewport(scon->gls, scon->surface, ww, wh); surface_gl_render_texture(scon->gls, scon->surface); SDL_GL_SwapWindow(scon->real_window); }
void gd_gl_area_draw(VirtualConsole *vc) { int ww, wh, y1, y2; if (!vc->gfx.gls) { return; } gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area); wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area); if (vc->gfx.scanout_mode) { if (!vc->gfx.fbo_id) { return; } glBindFramebuffer(GL_READ_FRAMEBUFFER, vc->gfx.fbo_id); /* GtkGLArea sets GL_DRAW_FRAMEBUFFER for us */ glViewport(0, 0, ww, wh); y1 = vc->gfx.y0_top ? 0 : vc->gfx.h; y2 = vc->gfx.y0_top ? vc->gfx.h : 0; glBlitFramebuffer(0, y1, vc->gfx.w, y2, 0, 0, ww, wh, GL_COLOR_BUFFER_BIT, GL_NEAREST); } else { if (!vc->gfx.ds) { return; } gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); } }