I’m trying to open a window fullscreen on second monitor, main app there.
I’ve just noticed glfwGetMonitors doesn’t work before ofCreateWindow.
Any ideas of how to accomplish this without creating two windows?
Danke Schön Obrigracias.
#include "ofMain.h"
#include "ofApp.h"
#include "GLFW/glfw3.h"
//========================================================================
int main( ){
ofGLFWWindowSettings settings;
// I don't want this one here
auto guiWindow = ofCreateWindow(settings);
int monitorCount;
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
if (monitorCount > 1) {
int a = 1;
int xM; int yM;
glfwGetMonitorPos(monitors[a], &xM, &yM);
glm::vec2 pos = glm::vec2(xM, yM);
const GLFWvidmode * desktopMode = glfwGetVideoMode(monitors[a]);
glm::vec2 size = glm::vec2(desktopMode->width, desktopMode->height);
settings.setSize (size.x, size.y);
settings.setPosition(pos);
settings.windowMode = OF_FULLSCREEN;
guiWindow = ofCreateWindow(settings);
auto mainApp = make_shared<ofApp>();
ofRunApp(guiWindow, std::move(mainApp));
ofRunMainLoop();
} else {
cout << monitorCount << endl;
}
}