Hi All,
I’m currently working on Windows Application with GLFW on 4 different viewports (4 separated child windows).
I’ve attached window menu when to create main window as below,
bool InitInstance(HINSTANCE hInstance) {
.
.
.
// Load main menu
mainMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDC_POINT3D));
// Create window
mainHwnd = CreateWindow((LPCSTR)application.className,
(LPCSTR)Title,
Style,
X,
Y,
Width,
Height,
HWND_DESKTOP,
mainMenu,
hInstance,
NULL
);
.
.
.
return 0;
}
and then created GLFW window like below
int CreateGLWindows(GL_Window& glWindow) {
// GLFW: Initialize and configure
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_DECORATED, GL_FALSE);
glfwWindowHint(GLFW_FOCUSED, GL_TRUE);
// GLFW window creation
glWindow.glfwHandle = glfwCreateWindow(glWindow.Width, glWindow.Height, glWindow.className, NULL, NULL);
glWindow.hWnd = glfwGetWin32Window(glWindow.glfwHandle);
if (glWindow.glfwHandle == NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
// Refine window style
long style = GetWindowLong(glWindow.hWnd, GWL_STYLE);
style &= ~(WS_POPUP | WS_CAPTION); // remove popup style
style |= WS_CHILD | CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
SetWindowLong(glWindow.hWnd, GWL_STYLE, style);
// GLAD: Load all OpenGL function pointers
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
.
.
.
SetParent(glWindow.hWnd, mainHwnd);
glfwSetWindowPos(glWindow.glfwHandle, glWindow.x, glWindow.y);
glfwShowWindow(glWindow.glfwHandle);
return 0;
}
Can you please share me out how to fix the issue below? or do I need to make my custom menu?
Thanks in advance,