6
6
* @author Martin Pulec <[email protected] >
7
7
*/
8
8
/*
9
- * Copyright (c) 2010-2024 CESNET, z. s. p. o.
9
+ * Copyright (c) 2010-2025 CESNET
10
10
* All rights reserved.
11
11
*
12
12
* Redistribution and use in source and binary forms, with or without
66
66
67
67
#include " color.h"
68
68
#ifdef HAVE_CONFIG_H
69
- #include " config.h"
69
+ #include " config.h" // for HAVE_SPOUT, HAVE_SYPHON
70
70
#endif
71
71
#include " debug.h"
72
72
#include " gl_context.h"
@@ -347,6 +347,7 @@ static constexpr pair<int64_t, string_view> keybindings[] = {
347
347
};
348
348
349
349
/* Prototyping */
350
+ static bool check_display_gl_version (bool print_ver);
350
351
static bool display_gl_init_opengl (struct state_gl *s);
351
352
static bool display_gl_putf (void *state, struct video_frame *frame, long long timeout);
352
353
static bool display_gl_process_key (struct state_gl *s, long long int key);
@@ -476,10 +477,6 @@ static constexpr codec_t gl_supp_codecs[] = {
476
477
};
477
478
478
479
static void gl_print_monitors (bool fullhelp) {
479
- if (ref_count_init_once<int >()(glfwInit, glfw_init_count).value_or (GLFW_TRUE) == GLFW_FALSE) {
480
- LOG (LOG_LEVEL_ERROR) << " Cannot initialize GLFW!\n " ;
481
- return ;
482
- }
483
480
printf (" \n monitors:\n " );
484
481
int count = 0 ;
485
482
GLFWmonitor **mon = glfwGetMonitors (&count);
@@ -511,8 +508,6 @@ static void gl_print_monitors(bool fullhelp) {
511
508
if (!fullhelp) {
512
509
cout << " (use \" fullhelp\" to see modes)\n " ;
513
510
}
514
-
515
- ref_count_terminate_last ()(glfwTerminate, glfw_init_count);
516
511
}
517
512
518
513
#define FEATURE_PRESENT (x ) (strcmp(STRINGIFY(x), " 1" ) == 0 ? " on" : " off" )
@@ -580,8 +575,21 @@ static void gl_show_help(bool full) {
580
575
col () << " \t " << TBOLD (<< keyname <<) << " \t\t " << i.second << " \n " ;
581
576
}
582
577
578
+ if (ref_count_init_once<int >()(glfwInit, glfw_init_count).value_or (GLFW_TRUE) == GLFW_FALSE) {
579
+ LOG (LOG_LEVEL_ERROR) << " Cannot initialize GLFW!\n " ;
580
+ return ;
581
+ }
583
582
gl_print_monitors (full);
584
- col () << " \n Compiled " << SBOLD (" features: " ) << " SPOUT - "
583
+ color_printf (" \n " );
584
+ GLFWwindow *window = glfwCreateWindow (32 , 32 , DEFAULT_WIN_NAME, nullptr , nullptr );
585
+ if (window != nullptr ) {
586
+ glfwMakeContextCurrent (window);
587
+ check_display_gl_version (true );
588
+ glfwDestroyWindow (window);
589
+ }
590
+ ref_count_terminate_last ()(glfwTerminate, glfw_init_count);
591
+
592
+ col () << " Compiled " << SBOLD (" features: " ) << " SPOUT - "
585
593
<< FEATURE_PRESENT (SPOUT) << " , Syphon - "
586
594
<< FEATURE_PRESENT (SYPHON) << " , VDPAU - "
587
595
<< FEATURE_PRESENT (HWACC_VDPAU) << " \n " ;
@@ -1444,7 +1452,9 @@ static void glfw_mouse_callback(GLFWwindow *win, double /* x */, double /* y */)
1444
1452
}
1445
1453
}
1446
1454
1447
- static bool display_gl_check_gl_version () {
1455
+ static bool
1456
+ check_display_gl_version (bool print_ver)
1457
+ {
1448
1458
auto version = (const char *) glGetString (GL_VERSION);
1449
1459
if (!version) {
1450
1460
log_msg (LOG_LEVEL_ERROR, MOD_NAME " Unable to get OpenGL version!\n " );
@@ -1454,8 +1464,12 @@ static bool display_gl_check_gl_version() {
1454
1464
log_msg (LOG_LEVEL_ERROR, MOD_NAME " ERROR: OpenGL 2.0 is not supported, try updating your drivers...\n " );
1455
1465
return false ;
1456
1466
}
1457
- log_msg (LOG_LEVEL_INFO, MOD_NAME " OpenGL 2.0 is supported...\n " );
1458
- MSG (VERBOSE, " Supported OpenGL version is %s.\n " , version);
1467
+ if (print_ver) { // from help
1468
+ color_printf (TBOLD (" OpenGL version:" ) " %s\n " , version);
1469
+ } else {
1470
+ MSG (INFO, " OpenGL 2.0 is supported...\n " );
1471
+ MSG (VERBOSE, " Supported OpenGL version is %s.\n " , version);
1472
+ }
1459
1473
return true ;
1460
1474
}
1461
1475
@@ -1728,7 +1742,7 @@ static bool display_gl_init_opengl(struct state_gl *s)
1728
1742
}
1729
1743
}
1730
1744
#endif
1731
- if (!display_gl_check_gl_version ( )) {
1745
+ if (!check_display_gl_version ( false )) {
1732
1746
glfwDestroyWindow (s->window );
1733
1747
s->window = nullptr ;
1734
1748
return false ;
0 commit comments