From 03169acc2136209e8fc70cd0ddc064c788a2c22e Mon Sep 17 00:00:00 2001 From: Dwayne Harris Date: Thu, 23 Sep 2021 20:42:23 -0400 Subject: [PATCH] First commit --- Makefile | 10 ++++++++++ main.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 Makefile create mode 100644 main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ea75145 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +all: build + +build: + gcc -Wall main.c -lobs -lglut -lGL -o main + +run: build + ./main + +clean: + rm main diff --git a/main.c b/main.c new file mode 100644 index 0000000..c97cb9f --- /dev/null +++ b/main.c @@ -0,0 +1,59 @@ +#include +#include +#include + +void render() { + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + glFlush(); +} + +int main(int argc, char** argv) { + const char* version; + + version = obs_get_version_string(); + printf("OBS version: %s\n", version); + + if (!obs_initialized()) { + if (!obs_startup("en-US", NULL, NULL)) { + printf("Failed to start OBS...\n"); + return 1; + } + + glutInit(&argc, argv); + + struct obs_video_info v; + struct obs_audio_info a; + + v.graphics_module = "libobs-opengl.so.0"; + v.fps_num = 30000; + v.fps_den = 1001; + v.base_width = 1280; + v.base_height = 720; + v.output_width = 1280; + v.output_height = 720; + v.output_format = VIDEO_FORMAT_NV12; + v.adapter = 0; + v.gpu_conversion = true; + v.colorspace = VIDEO_CS_601; + v.range = VIDEO_RANGE_PARTIAL; + v.scale_type = OBS_SCALE_BICUBIC; + + a.samples_per_sec = 44100; + a.speakers = SPEAKERS_STEREO; + + obs_reset_video(&v); + obs_reset_audio(&a); + } + + glutInitDisplayMode(GLUT_SINGLE); + glutInitWindowSize(500, 500); + glutInitWindowPosition(100, 100); + glutCreateWindow("OBS Window"); + glutDisplayFunc(render); + glutMainLoop(); + + obs_shutdown(); + + return 0; +}