static inline void render_display_begin(struct obs_display *display) { struct vec4 clear_color; gs_load_swapchain(display ? display->swap : NULL); if (display->size_changed) { gs_resize(display->cx, display->cy); display->size_changed = false; } gs_beginscene(); vec4_set(&clear_color, 0.3f, 0.3f, 0.3f, 1.0f); gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH | GS_CLEAR_STENCIL, &clear_color, 1.0f, 0); gs_enable_depthtest(false); /* gs_enable_blending(false); */ gs_setcullmode(GS_NEITHER); gs_ortho(0.0f, (float)display->cx, 0.0f, (float)display->cy, -100.0f, 100.0f); gs_setviewport(0, 0, display->cx, display->cy); }
void gs_resetviewport(void) { uint32_t cx, cy; assert(thread_graphics != NULL); gs_getsize(&cx, &cy); gs_setviewport(0, 0, (int)cx, (int)cy); }
static inline void set_render_size(uint32_t width, uint32_t height) { gs_enable_depthtest(false); gs_enable_blending(false); gs_setcullmode(GS_NEITHER); gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); gs_setviewport(0, 0, width, height); }
void gs_viewport_pop(void) { struct gs_rect *rect; if (!thread_graphics->viewport_stack.num) return; rect = da_end(thread_graphics->viewport_stack); gs_setviewport(rect->x, rect->y, rect->cx, rect->cy); da_pop_back(thread_graphics->viewport_stack); }
static inline void render_begin(struct obs_display *display) { struct vec4 clear_color; uint32_t width, height; gs_load_swapchain(display ? display->swap : NULL); gs_getsize(&width, &height); gs_beginscene(); vec4_set(&clear_color, 0.3f, 0.0f, 0.0f, 1.0f); gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH | GS_CLEAR_STENCIL, &clear_color, 1.0f, 0); gs_enable_depthtest(false); /* gs_enable_blending(false); */ gs_setcullmode(GS_NEITHER); gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); gs_setviewport(0, 0, width, height); }
void gs_resetviewport(void) { uint32_t cx, cy; gs_getsize(&cx, &cy); gs_setviewport(0, 0, (int)cx, (int)cy); }