提交 24c45458 编写于 作者: J jp9000

use the preview window as the main window associated with the OpenGL context

上级 a8ada497
......@@ -42,7 +42,7 @@ Settings.Video.DisableAeroWindows="Disable Aero (Windows only)"
Settings.Video.FPS="FPS:"
Settings.Video.FPS.Common="Common FPS Values"
Settings.Video.FPS.Integer="Integer FPS Value"
Settings.VIdeo.FPS.Fraction="Frame Interval (fraction)"
Settings.VIdeo.FPS.Fraction="Fractional FPS Value"
Settings.Video.FPS.Nanoseconds="Frame Interval (nanoseconds)"
Settings.Video.FPS.Numerator="Numerator:"
Settings.Video.FPS.Denominator="Denominator:"
......
......@@ -36,11 +36,10 @@ static void tick_sources(uint64_t cur_time, uint64_t *last_time)
*last_time = cur_time;
}
static inline void render_display(struct obs_display *display)
static inline void render_begin(struct obs_display *display)
{
struct vec4 clear_color;
uint32_t width, height;
size_t i;
gs_load_swapchain(display ? display->swap : NULL);
......@@ -58,6 +57,19 @@ static inline void render_display(struct obs_display *display)
gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f);
gs_setviewport(0, 0, width, height);
}
static inline void render_end(struct obs_display *display)
{
gs_endscene();
gs_present();
}
static void render_display(struct obs_display *display)
{
size_t i;
render_begin(display);
for (i = 0; i < MAX_CHANNELS; i++) {
struct obs_source **p_source;
......@@ -74,8 +86,7 @@ static inline void render_display(struct obs_display *display)
}
}
gs_endscene();
gs_present();
render_end(display);
}
static inline void render_displays(void)
......@@ -85,8 +96,9 @@ static inline void render_displays(void)
/* render extra displays/swaps */
pthread_mutex_lock(&obs->data.displays_mutex);
for (i = 0; i < obs->data.displays.num; i++)
for (i = 0; i < obs->data.displays.num; i++) {
render_display(obs->data.displays.array[i]);
}
pthread_mutex_unlock(&obs->data.displays_mutex);
......
......@@ -199,24 +199,24 @@ bool OBSApp::OnInit()
wxInitAllImageHandlers();
dummyWindow = new wxFrame(NULL, wxID_ANY, "Dummy Window");
OBSBasic *mainWindow = new OBSBasic();
wxSize size = mainWindow->GetPreviewPanel()->GetClientSize();
/* this is a test */
struct obs_video_info ovi;
ovi.graphics_module = "libobs-opengl";
ovi.fps_num = 30000;
ovi.fps_den = 1001;
ovi.window_width = 2;
ovi.window_height = 2;
ovi.window_width = size.x;
ovi.window_height = size.y;
ovi.base_width = 1920;
ovi.base_height = 1080;
ovi.output_width = 1280;
ovi.output_height = 720;
ovi.output_format = VIDEO_FORMAT_RGBA;
ovi.adapter = 0;
ovi.window = WxToGSWindow(dummyWindow);
ovi.window = WxToGSWindow(mainWindow->GetPreviewPanel());
if (!obs_reset_video(&ovi))
return false;
......@@ -229,9 +229,6 @@ int OBSApp::OnExit()
{
obs_shutdown();
delete dummyWindow;
dummyWindow = NULL;
return wxApp::OnExit();
}
......
......@@ -29,7 +29,6 @@ public:
class OBSApp : public OBSAppBase {
ConfigFile globalConfig;
TextLookup textLookup;
wxFrame *dummyWindow;
bool InitGlobalConfig();
bool InitGlobalConfigDefaults();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册