Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

Trying to use GLFW APIs but it crashes

$
0
0

I’m macOS/ M1 and I’m trying to get multiple windows raised on top programmatically.
It seems the only way is to use glfwFocusWindow.
So this is how I’m trying to do:

in .h file

#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

in .cpp file setup():

void ofApp::setup()
{
      glfwInit();
      .......
}

in .cpp file where I need it:

GLFWwindow* w = (GLFWwindow*) ofGetWindowPtr()->getCocoaWindow();
glfwFocusWindow(w);

But it crashes badly, always, getting an infinite crash message which is impossible for me to understand.

BTW It crashes with any GLFW function I try, for any window setting function, like
glfwShowWindow(GLFWwindow*) or glfwSetWindowTitle(GLFWwindow*, const char* title)

Otherwise GLFW general getting functions work fine, like
glfwGetMonitors(int*) or glfwGetVideoMode(GLFWmonitor* )

I suspect something is wrong in getting GLFWwindow pointer.
Anyone has any clue?
Or, in alternative, any other method to get focus and raise on top a window in macOS?

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles