mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 23:40:18 +00:00
common_preinit: call glutInit in macOS
Call glutInit for macOS. This is rather a workaround to fix a problem when running 'uv --capabilities' with RTDXT and Syphon. Initialization of GLUT in Syphon then fails because glutInit is skipped since NSApp is a non-NULL (from initialization of GL context). Further GLUT call then fail.
This commit is contained in:
@@ -57,6 +57,10 @@
|
||||
#include "debug.h"
|
||||
#include "gl_context.h"
|
||||
|
||||
#if defined HAVE_GL && !defined HAVE_MACOSX
|
||||
# include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief initializes specified OpenGL context
|
||||
*
|
||||
@@ -226,4 +230,18 @@ void gl_context_make_current(struct gl_context *context)
|
||||
#endif
|
||||
}
|
||||
|
||||
void uvGlutInit(int *argcp, char **argv)
|
||||
{
|
||||
#ifdef HAVE_GL
|
||||
# ifdef HAVE_MACOSX
|
||||
macGlutInit(argcp, argv);
|
||||
# else
|
||||
glutInit(argcp, argv);
|
||||
# endif
|
||||
#else
|
||||
UNUSED(argcp);
|
||||
UNUSED(argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* defined HAVE_MACOSX || (defined HAVE_LINUX && defined HAVE_LIBGLEW) */
|
||||
|
||||
@@ -127,6 +127,7 @@ static void gl_check_error()
|
||||
|
||||
GLuint glsl_compile_link(const char *vprogram, const char *fprogram);
|
||||
|
||||
void uvGlutInit(int *argcp, char **argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
#define X11_LIB_NAME "libX11.so.6"
|
||||
#endif
|
||||
|
||||
#if defined HAVE_GL && defined HAVE_MACOSX
|
||||
#include <GLUT/glut.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_MTRACE
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
@@ -216,6 +220,10 @@ struct init_data *common_preinit(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined HAVE_GL && defined HAVE_MACOSX
|
||||
glutInit(&uv_argc, uv_argv);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsaData;
|
||||
int err = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
|
||||
@@ -43,4 +43,5 @@ int get_mac_kernel_version_major();
|
||||
void *mac_gl_init(mac_opengl_version_t);
|
||||
void mac_gl_free(void *);
|
||||
void mac_gl_make_current(void *);
|
||||
void macGlutInit(int *argcp, char **argv);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <GLUT/glut.h>
|
||||
|
||||
#ifndef __MAC_10_11
|
||||
#warning "You are compling on pre-10.7 Mac OS X version. Core OpenGL 3.2 profile won't work"
|
||||
@@ -207,3 +207,10 @@ void mac_gl_make_current(void * state)
|
||||
}
|
||||
@end
|
||||
|
||||
void macGlutInit(int *argcp, char **argv)
|
||||
{
|
||||
if (NSApp == nil) {
|
||||
glutInit(argcp, argv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ static void syphon_mainloop(void *state)
|
||||
state_global = (struct state_vidcap_syphon *) state;
|
||||
struct state_vidcap_syphon *s = state_global;
|
||||
|
||||
glutInit(&uv_argc, uv_argv);
|
||||
uvGlutInit(&uv_argc, uv_argv);
|
||||
glutInitDisplayMode(GLUT_RGB);
|
||||
s->window = glutCreateWindow("dummy Syphon client window");
|
||||
glutHideWindow();
|
||||
|
||||
@@ -1160,7 +1160,7 @@ static bool display_gl_init_opengl(struct state_gl *s)
|
||||
glutInitErrorFunc(glut_init_error_callback);
|
||||
if (setjmp(error_env) == 0) {
|
||||
#endif
|
||||
glutInit(&uv_argc, uv_argv);
|
||||
uvGlutInit(&uv_argc, uv_argv);
|
||||
#ifdef FREEGLUT
|
||||
} else {
|
||||
exit_uv(EXIT_FAIL_DISPLAY);
|
||||
|
||||
Reference in New Issue
Block a user