Use only one widget for preview

Modify the obs_display API so that it always uses an orthographic
projection that is the size of the display, rather than OBS' base size.
Having it do an orthographic projection to OBS' base size was silly
because it meant that everything would be skewed if you wanted to draw
1:1 in the display.  This deoes mean that the callbacks must handle
resizing the images, but it's worth it to ensure 1:1 draw sizes.

As for the preview widget, instead of making some funky widget within
widget that resizes, it's just going to be a widget within the entire
top layout.  Also changed the preview padding color to gray.
This commit is contained in:
jp9000
2014-03-07 10:19:03 -07:00
parent 7d48dbb1dc
commit e8044d0868
7 changed files with 45 additions and 47 deletions

View File

@@ -130,7 +130,8 @@ static inline void render_display_begin(struct obs_display *display)
}
gs_beginscene();
vec4_set(&clear_color, 0.3f, 0.0f, 0.0f, 1.0f);
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);
@@ -138,8 +139,8 @@ static inline void render_display_begin(struct obs_display *display)
/* gs_enable_blending(false); */
gs_setcullmode(GS_NEITHER);
gs_ortho(0.0f, (float)obs->video.base_width,
0.0f, (float)obs->video.base_height, -100.0f, 100.0f);
gs_ortho(0.0f, (float)display->cx,
0.0f, (float)display->cy, -100.0f, 100.0f);
gs_setviewport(0, 0, display->cx, display->cy);
}