-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Hello this simple code causes the error reported below, what am I doing wrong ? note that this eror appears only in fullscreen mode.
`
// Use OpenGL 3.1 core
// SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
`
// antialiasing
if (IsAntialiased)
{
if (!SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1))
vml::os::Message::Error("SDL : ", "couldn't set up multisample buffers");
if (!SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4))
vml::os::Message::Error("SDL : ", "couldn't set up multi samples");
glEnable(GL_MULTISAMPLE);
}
// Also request a depth buffer
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
// Create window
GlWindow = SDL_CreateWindow(Title.c_str(), ScreenWidth, ScreenHeight, SDL_WINDOW_OPENGL);
if (!GlWindow)
vml::os::Message::Error("SDL : ", "couldn't set up video mode");
// check if window is at fullscreen or not
if (IsMaximized && !IsFullScreen)
{
SDL_SetWindowResizable(GlWindow, true);
SDL_MaximizeWindow(GlWindow);
SDL_SetWindowRelativeMouseMode(GlWindow, true);
}
if (IsFullScreen && !IsMaximized)
{
// SDL_SetWindowResizable(GlWindow, false);
SDL_SetWindowFullscreen(GlWindow, true);
SDL_SetWindowRelativeMouseMode(GlWindow, false);
SDL_SyncWindow(GlWindow);
}
// exit on esc pressed ?
ExitOnEsc = PreferencesFlags.Get(vml::flags::Preferences::EXITONESC);
// retrieve window size, this is necessary for fullscreen
SDL_GetWindowSizeInPixels(GlWindow, &ScreenWidth, &ScreenHeight);
// set relative mouse motion
if (IsMouseHidden)
SDL_HideCursor();
else
SDL_ShowCursor();
// create opengl window
GlContext = SDL_GL_CreateContext(GlWindow);
if (!GlContext)
{
vml::os::Message::Error("OpenGL context could not be created! SDL Error: %s\n", SDL_GetError());
}
else
{
// Initialize GLEW
glewExperimental = GL_TRUE;
GLenum glewError = glewInit();
if (glewError != GLEW_OK)
vml::os::Message::Error("Error initializing GLEW! %s\n", glewGetErrorString(glewError));
// Use Vsync
if (IsSwapScreenLocked)
{
if (!SDL_GL_SetSwapInterval(1))
vml::os::Message::Error("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
}
else
{
if (!SDL_GL_SetSwapInterval(0))
vml::os::Message::Error("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
}
// Initialize OpenGL
if (!InitGLResources())
vml::os::Message::Error("Unable to initialize OpenGL!\n");
}
vml::logger::Logger2::GetInstance()->Info({ "SDL API", "SDL Inittialized" });
`
clientcore\windows\dwm\dwmapi\attribute.cpp(135)\dwmapi.dll!00007FFA331C4AF3:(caller: 00007FF970048045) ReturnHr(1) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFA331C3827: (caller: 00007FF970048059) ReturnHr(2) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(135)\dwmapi.dll!00007FFA331C4AF3: (caller: 00007FF970047D15) ReturnHr(3) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFA331C3827: (caller: 00007FF970047D29) ReturnHr(4) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(135)\dwmapi.dll!00007FFA331C4AF3: (caller: 00007FF970048045) ReturnHr(5) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFA331C3827: (caller: 00007FF970048059) ReturnHr(6) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(135)\dwmapi.dll!00007FFA331C4AF3: (caller: 00007FF970047D15) ReturnHr(7) tid(5f8) 80070057 Parametro non corretto. clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFA331C3827: (caller: 00007FF970047D29) ReturnHr(8) tid(5f8) 80070057 Parametro non
corretto.