-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window don't open #782
Comments
Can we see your code? |
I have the same code inserted in a big engine. Work perfect inside the IDE but after compiled, the Debug and Release from explorer do not open the glfwwindow. #include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
static void error_callback(int error, const char* description)
{
fputs(description, stderr);
_fgetchar();
}
int main(void)
{
//Set the error callback
glfwSetErrorCallback(error_callback);
//Initialize GLFW
if (!glfwInit())
{
exit(EXIT_FAILURE);
}
//Declare a window object
GLFWwindow* window;
//Create a window and create its OpenGL context
window = glfwCreateWindow(1505, 920, "Test Window", NULL, NULL); //glfwGetPrimaryMonitor()
//If the window couldn't be created
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
//This function makes the context of the specified window current on the calling thread.
glfwMakeContextCurrent(window);
//Initialize GLEW
GLenum err = glewInit();
//If GLEW hasn't initialized
if (err != GLEW_OK)
{
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
return -1;
}
//Set a background color
glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
//Main Loop
do
{
//Clear color buffer
glClear(GL_COLOR_BUFFER_BIT);
//Get and organize events, like keyboard and mouse input, window resizing, etc...
glfwPollEvents();
//Swap buffers
glfwSwapBuffers(window);
} //Check if the ESC key had been pressed or if the window had been closed
while (!glfwWindowShouldClose(window));
//Close OpenGL window and terminate GLFW
glfwDestroyWindow(window);
//Finalize and clean up GLFW
glfwTerminate();
exit(EXIT_SUCCESS);
} |
I just try with and did work with this change. window = glfwCreateWindow(1920, 1080, "Test Window", glfwGetPrimaryMonitor(), NULL); But without glfwGetPrimaryMonitor() don't work. Thank. |
@Sorento When the program fails, what message does it print? |
Just an empty Console Window ! |
I'm experiencing a very similar issue, also on a Windows 10, MSI with Nvidia GTX960M. In my case I try to create a fullscreen window on the secondary monitor (which is in extended mode). CPU goes to about 16% for the app and just stays there with an unresponsive blank window. I'll try to debug, but it's not my machine so not sure how far I'll get. I have tried to reproduce this on a different Windows 10/NVIDIA setup, but was not successful. Side note in case it's helpful: if I put the dual screens in clone mode, the game runs fine except for when I go to close it. The window goes away but the process does not. It's possible this is in my code, but I've never seen this before except on the machine on which I'm having dual monitor issues with. |
Following up: |
Some more info: |
Workaround confirmed: |
I have this issue as well, I can only successfully launch if my game is running on my PRIMARY monitor. If it runs on my SECONDARY monitor glfwCreateWindow hangs indefinitely.
However, other than @Sheado, I don't have an audio manager running I can stop. I have an ASUS motherboard and the audio drivers are running as a background service... Also, I am working in windowed mode, so I am not specifying any monitor to glfwCreateWindow. And since I need a GLFWwindow* pointer before I can call glfwSetWindowPos, I'm kinda stuck on this... |
For everybody's information, there is apparently a long history of conflicts and issues with Nahimic and games: https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/ |
For anyone experiencing this issue without any clue as to what Nahimic is, be sure to include all of the assets from your project relative to the location of your .exe file; it can cause this exact behavior. Especially if you're using assertions in your code, the compiler can sometimes optimize them (str8 up delete them) depending on subsequent instructions in your code. |
Glfw Window don't open after clicking .exe file in release or debug version. Only work inside IDE.
The text was updated successfully, but these errors were encountered: