void wm_draw_update(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; int drawmethod; GPU_free_unused_buffers(); for (win = wm->windows.first; win; win = win->next) { #ifdef WIN32 if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) { GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin); if (state == GHOST_kWindowStateMinimized) { /* do not update minimized windows, it gives issues on intel drivers (see [#33223]) * anyway, it seems logical to skip update for invisible windows */ continue; } } #endif if (win->drawmethod != U.wmdrawmethod) { wm_draw_window_clear(win); win->drawmethod = U.wmdrawmethod; } if (wm_draw_update_test_window(win)) { CTX_wm_window_set(C, win); /* sets context window+screen */ wm_window_make_drawable(wm, win); /* notifiers for screen redraw */ if (win->screen->do_refresh) ED_screen_refresh(wm, win); drawmethod = wm_automatic_draw_method(win); if (win->drawfail) wm_method_draw_overlap_all(C, win, 0); else if (drawmethod == USER_DRAW_FULL) wm_method_draw_full(C, win); else if (drawmethod == USER_DRAW_OVERLAP) wm_method_draw_overlap_all(C, win, 0); else if (drawmethod == USER_DRAW_OVERLAP_FLIP) wm_method_draw_overlap_all(C, win, 1); else // if (drawmethod == USER_DRAW_TRIPLE) wm_method_draw_triple(C, win); win->screen->do_draw_gesture = false; win->screen->do_draw_paintcursor = false; win->screen->do_draw_drag = false; wm_window_swap_buffers(win); CTX_wm_window_set(C, NULL); } } }
/* belongs to below */ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; int scr_w, scr_h, posy; wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); #if defined(__APPLE__) && !defined(GHOST_COCOA) { extern int macPrefState; /* creator.c */ initial_state += macPrefState; } #endif /* Disable AA for now, as GL_SELECT (used for border, lasso, ... select) * doesn't work well when AA is initialized, even if not used. */ ghostwin = GHOST_CreateWindow(g_system, title, win->posx, posy, win->sizex, win->sizey, (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, 0 /* no AA */); if (ghostwin) { /* needed so we can detect the graphics card below */ GPU_extensions_init(); /* set the state*/ GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { glClear(GL_COLOR_BUFFER_BIT); } wm_window_swap_buffers(win); //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); GPU_state_init(); } }
void wm_draw_update(bContext *C) { wmWindowManager *wm= CTX_wm_manager(C); wmWindow *win; int drawmethod; GPU_free_unused_buffers(); for(win= wm->windows.first; win; win= win->next) { if(win->drawmethod != U.wmdrawmethod) { wm_draw_window_clear(win); win->drawmethod= U.wmdrawmethod; } if(wm_draw_update_test_window(win)) { CTX_wm_window_set(C, win); /* sets context window+screen */ wm_window_make_drawable(C, win); /* notifiers for screen redraw */ if(win->screen->do_refresh) ED_screen_refresh(wm, win); drawmethod= wm_automatic_draw_method(win); if(win->drawfail) wm_method_draw_overlap_all(C, win, 0); else if(drawmethod == USER_DRAW_FULL) wm_method_draw_full(C, win); else if(drawmethod == USER_DRAW_OVERLAP) wm_method_draw_overlap_all(C, win, 0); else if(drawmethod == USER_DRAW_OVERLAP_FLIP) wm_method_draw_overlap_all(C, win, 1); else // if(drawmethod == USER_DRAW_TRIPLE) wm_method_draw_triple(C, win); win->screen->do_draw_gesture= 0; win->screen->do_draw_paintcursor= 0; win->screen->do_draw_drag= 0; wm_window_swap_buffers(win); CTX_wm_window_set(C, NULL); } } }
void KX_BlenderCanvas::SwapBuffers() { wm_window_swap_buffers(m_win); }
/* belongs to below */ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; GHOST_GLSettings glSettings = {0}; static int multisamples = -1; int scr_w, scr_h, posy; /* force setting multisamples only once, it requires restart - and you cannot * mix it, either all windows have it, or none (tested in OSX opengl) */ if (multisamples == -1) multisamples = U.ogl_multisamples; glSettings.numOfAASamples = multisamples; /* a new window is created when pageflip mode is required for a window */ if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) glSettings.flags |= GHOST_glStereoVisual; if (G.debug & G_DEBUG_GPU) { glSettings.flags |= GHOST_glDebugContext; } if (!(U.uiflag2 & USER_OPENGL_NO_WARN_SUPPORT)) glSettings.flags |= GHOST_glWarnSupport; wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); ghostwin = GHOST_CreateWindow(g_system, title, win->posx, posy, win->sizex, win->sizey, (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, glSettings); if (ghostwin) { GHOST_RectangleHandle bounds; /* the new window has already been made drawable upon creation */ wm->windrawable = win; /* needed so we can detect the graphics card below */ GPU_init(); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); #ifdef __APPLE__ /* set the state here, else OSX would not recognize changed screen resolution */ /* we agreed to not set any fullscreen or iconized state on startup */ GHOST_SetWindowState(ghostwin, GHOST_kWindowStateNormal); #endif /* store actual window size in blender window */ bounds = GHOST_GetClientBounds(win->ghostwin); win->sizex = GHOST_GetWidthRectangle(bounds); win->sizey = GHOST_GetHeightRectangle(bounds); GHOST_DisposeRectangle(bounds); #ifndef __APPLE__ /* set the state here, so minimized state comes up correct on windows */ GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); #endif /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { glClear(GL_COLOR_BUFFER_BIT); } /* displays with larger native pixels, like Macbook. Used to scale dpi with */ /* needed here, because it's used before it reads userdef */ U.pixelsize = wm_window_pixelsize(win); BKE_userdef_state(); wm_window_swap_buffers(win); //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); GPU_state_init(); } }
void BL_SwapBuffers(wmWindow *win) { //wmWindow *window= CTX_wm_window(C); wm_window_swap_buffers(win); //XXX myswapbuffers(); }
/* belongs to below */ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; static int multisamples = -1; int scr_w, scr_h, posy; /* force setting multisamples only once, it requires restart - and you cannot * mix it, either all windows have it, or none (tested in OSX opengl) */ if (multisamples == -1) multisamples = U.ogl_multisamples; wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); ghostwin = GHOST_CreateWindow(g_system, title, win->posx, posy, win->sizex, win->sizey, (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, multisamples /* AA */); if (ghostwin) { GHOST_RectangleHandle bounds; /* needed so we can detect the graphics card below */ GPU_extensions_init(); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); /* set the state */ GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { glClear(GL_COLOR_BUFFER_BIT); } /* displays with larger native pixels, like Macbook. Used to scale dpi with */ /* needed here, because it's used before it reads userdef */ U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin); BKE_userdef_state(); /* store actual window size in blender window */ bounds = GHOST_GetClientBounds(win->ghostwin); win->sizex = GHOST_GetWidthRectangle(bounds); win->sizey = GHOST_GetHeightRectangle(bounds); GHOST_DisposeRectangle(bounds); wm_window_swap_buffers(win); //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); GPU_state_init(); } }
void BL_SwapBuffers(wmWindow *win) { wm_window_swap_buffers(win); }