Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw.c
| Show First 20 Lines • Show All 2,121 Lines • ▼ Show 20 Lines | ImBuf *ED_view3d_draw_offscreen_imbuf( | ||||
| float winmat[4][4]; | float winmat[4][4]; | ||||
| if (ofs && ((GPU_offscreen_width(ofs) != sizex) || (GPU_offscreen_height(ofs) != sizey))) { | if (ofs && ((GPU_offscreen_width(ofs) != sizex) || (GPU_offscreen_height(ofs) != sizey))) { | ||||
| /* sizes differ, can't reuse */ | /* sizes differ, can't reuse */ | ||||
| ofs = NULL; | ofs = NULL; | ||||
| } | } | ||||
| const bool own_ofs = (ofs == NULL); | const bool own_ofs = (ofs == NULL); | ||||
| DRW_ogl_ctx_enable(); | |||||
| if (own_ofs) { | if (own_ofs) { | ||||
| /* bind */ | /* bind */ | ||||
| ofs = GPU_offscreen_create(sizex, sizey, use_full_sample ? 0 : samples, false, err_out); | ofs = GPU_offscreen_create(sizex, sizey, use_full_sample ? 0 : samples, false, err_out); | ||||
| if (ofs == NULL) { | if (ofs == NULL) { | ||||
| return NULL; | return NULL; | ||||
brecht: Disable the context here. | |||||
| } | } | ||||
| } | } | ||||
| ED_view3d_draw_offscreen_init(eval_ctx, scene, view_layer, v3d); | ED_view3d_draw_offscreen_init(eval_ctx, scene, view_layer, v3d); | ||||
| GPU_offscreen_bind(ofs, true); | GPU_offscreen_bind(ofs, true); | ||||
| /* read in pixels & stamp */ | /* read in pixels & stamp */ | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | ImBuf *ED_view3d_draw_offscreen_imbuf( | ||||
| /* unbind */ | /* unbind */ | ||||
| GPU_offscreen_unbind(ofs, true); | GPU_offscreen_unbind(ofs, true); | ||||
| if (own_ofs) { | if (own_ofs) { | ||||
| GPU_offscreen_free(ofs); | GPU_offscreen_free(ofs); | ||||
| } | } | ||||
| DRW_ogl_ctx_disable(); | |||||
| if (ibuf->rect_float && ibuf->rect) | if (ibuf->rect_float && ibuf->rect) | ||||
| IMB_rect_from_float(ibuf); | IMB_rect_from_float(ibuf); | ||||
| return ibuf; | return ibuf; | ||||
| } | } | ||||
| /** | /** | ||||
| * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen_imbuf) | * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen_imbuf) | ||||
| ▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines | |||||
Disable the context here.