Attach A GLFWwindow To Windows Window Client Area?


#1

Hi Folks:

Developing on Windows 10 Pro, Visual Studio 2017, C++.

I posted this a couple of weeks ago.

The first window my application opens has a row of menu drop down across the top.

All of the application’s real business is done through dialogs that are accessed through the menu items.

I want this opening screen to serve as a splash screen, with some attractive animated 3D graphics. This will be in the background as the user works with the dialogs displayed in front of it.

So I’d like an GLFWwindow to be attached to the client area of the first screen. As the application’s first screen is moved or resized the GLFWwindow should seamlessly move and resize with it.

I’m sure there’s a site describing exactly what I need to do, but I thought I’d give it a shot.

I’m sizing and positioning a GLFWwindow over the main window’s client rectangle by servicing the main window dialog’s WM_SIZE, WM_MOVE and WM_WINDOWPOSCHANGED.

I had to use the GLFW_FLOATING hint in order to display the splash screen over the main window. .

The problem now is that the GLFWwindow is top most, and the dialogs that pop from the menus are displayed behind it.

Is there a way to have the GLFWwindow display in front of a particular Windows window?

Or better yet, can I throw this first experiment away and go to a site that shows me what to do?

  Thanks
  Larry

Embedding opengl glfw context into wxGLContext?
#2

GLFW has an open issue on creating an OpenGL context in an existing window.

Trying to achieve this with an extra window is going to be very difficult to get right as you’re finding. The alternatives are to use a UI system such as Qt which has an OpenGL widget you can use, or use an OpenGL UI library for your main menu such as in this post on UI in GLFW.


#3

Thanks dougbinks:

I found this page that describes using PIXELFORMATDESCRIPTOR to create an OpenGL context in a Windows window.

I’d like to work with a GLFWwindow after I get this set up, but I don’t know how to do that, fi it can be done.

The tutorial I’ve been using to learn OpenGL uses glfwCreateWindow() to create the window and then calls glfwMakeContextCurrent(window) to create the context. Now that I’m becoming familiar with GLFW I’d rather not change to another OpenGL interface. I’ve already built some nice tools that rely on GLFW.

Is there some way to use GLFW after I create the context with PIXELFORMATDESCRIPTOR and wglMakeCurrent?

Thanks
Larry


#4

@larryl Why do you want to create the context manually if you’re going to attach the window to GLFW?


#5

Thanks Everybody:

I think I get it.

I’m using Windows to run the user interface, so I won’t be using GLFW.

Sorry that took so long for me to figure out.