mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 19:09:18 +02:00
match video modes for extra windows, python vsync option
This commit is contained in:
@@ -796,6 +796,11 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
Parser >> python_threadedupload;
|
Parser >> python_threadedupload;
|
||||||
}
|
}
|
||||||
|
else if (token == "python.vsync")
|
||||||
|
{
|
||||||
|
Parser.getTokens(1);
|
||||||
|
Parser >> python_vsync;
|
||||||
|
}
|
||||||
else if (token == "python.mipmaps")
|
else if (token == "python.mipmaps")
|
||||||
{
|
{
|
||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ struct global_settings {
|
|||||||
bool python_mipmaps = true;
|
bool python_mipmaps = true;
|
||||||
bool python_displaywindows = false;
|
bool python_displaywindows = false;
|
||||||
bool python_threadedupload = true;
|
bool python_threadedupload = true;
|
||||||
|
bool python_vsync = true;
|
||||||
|
|
||||||
int gfx_framebuffer_width = -1;
|
int gfx_framebuffer_width = -1;
|
||||||
int gfx_framebuffer_height = -1;
|
int gfx_framebuffer_height = -1;
|
||||||
|
|||||||
@@ -480,9 +480,17 @@ eu07_application::window( int const Windowindex, bool visible, int width, int he
|
|||||||
}
|
}
|
||||||
// for index -1 create a new child window
|
// for index -1 create a new child window
|
||||||
|
|
||||||
|
auto const *vmode { glfwGetVideoMode( monitor ? monitor : glfwGetPrimaryMonitor() ) };
|
||||||
|
|
||||||
|
glfwWindowHint( GLFW_RED_BITS, vmode->redBits );
|
||||||
|
glfwWindowHint( GLFW_GREEN_BITS, vmode->greenBits );
|
||||||
|
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
||||||
|
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
||||||
|
|
||||||
glfwWindowHint( GLFW_VISIBLE, visible );
|
glfwWindowHint( GLFW_VISIBLE, visible );
|
||||||
|
|
||||||
auto *childwindow = glfwCreateWindow( width, height, "eu07helper", monitor, m_windows.front() );
|
auto *childwindow = glfwCreateWindow( width, height, "eu07helper", monitor,
|
||||||
|
!m_windows.empty() ? m_windows.front() : nullptr);
|
||||||
if (!childwindow)
|
if (!childwindow)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@@ -620,15 +628,6 @@ eu07_application::init_glfw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto *monitor { find_monitor(Global.fullscreen_monitor) };
|
auto *monitor { find_monitor(Global.fullscreen_monitor) };
|
||||||
if (!monitor)
|
|
||||||
monitor = glfwGetPrimaryMonitor();
|
|
||||||
|
|
||||||
auto const *vmode { glfwGetVideoMode( monitor ) };
|
|
||||||
|
|
||||||
glfwWindowHint( GLFW_RED_BITS, vmode->redBits );
|
|
||||||
glfwWindowHint( GLFW_GREEN_BITS, vmode->greenBits );
|
|
||||||
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
|
||||||
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SRGB_CAPABLE, !Global.gfx_shadergamma);
|
glfwWindowHint(GLFW_SRGB_CAPABLE, !Global.gfx_shadergamma);
|
||||||
|
|
||||||
@@ -653,22 +652,14 @@ eu07_application::init_glfw() {
|
|||||||
glfwWindowHint( GLFW_SAMPLES, 1 << Global.iMultisampling );
|
glfwWindowHint( GLFW_SAMPLES, 1 << Global.iMultisampling );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *window {
|
auto *win = window(-1, true, Global.iWindowWidth, Global.iWindowHeight, Global.bFullScreen ? monitor : nullptr);
|
||||||
glfwCreateWindow(
|
|
||||||
Global.iWindowWidth,
|
|
||||||
Global.iWindowHeight,
|
|
||||||
Global.AppName.c_str(),
|
|
||||||
( Global.bFullScreen ?
|
|
||||||
monitor :
|
|
||||||
nullptr ),
|
|
||||||
nullptr ) };
|
|
||||||
|
|
||||||
if( window == nullptr ) {
|
if( win == nullptr ) {
|
||||||
ErrorLog( "Bad init: failed to create glfw window" );
|
ErrorLog( "Bad init: failed to create glfw window" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent( window );
|
glfwMakeContextCurrent( win );
|
||||||
glfwSwapInterval( Global.VSync ? 1 : 0 ); //vsync
|
glfwSwapInterval( Global.VSync ? 1 : 0 ); //vsync
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -682,13 +673,11 @@ eu07_application::init_glfw() {
|
|||||||
if (Global.captureonstart)
|
if (Global.captureonstart)
|
||||||
{
|
{
|
||||||
Global.ControlPicking = false;
|
Global.ControlPicking = false;
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Global.ControlPicking = true;
|
Global.ControlPicking = true;
|
||||||
|
|
||||||
m_windows.emplace_back( window );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void python_screen_viewer::threadfunc()
|
|||||||
for (auto &window : m_windows) {
|
for (auto &window : m_windows) {
|
||||||
glfwMakeContextCurrent(window.window);
|
glfwMakeContextCurrent(window.window);
|
||||||
|
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(Global.python_vsync ? 1 : 0);
|
||||||
GLuint v;
|
GLuint v;
|
||||||
glGenVertexArrays(1, &v);
|
glGenVertexArrays(1, &v);
|
||||||
glBindVertexArray(v);
|
glBindVertexArray(v);
|
||||||
|
|||||||
Reference in New Issue
Block a user