// Create an OpenGL context associated with the window.
_glcontext = SDL_GL_CreateContext(_window);
If I only do this once I can see everything on screen, the game works fine at the start chosen resolution.
However I want resolution options on my game, couldn’t find any resize window function so I’m doing this to resize, I destroy the windows and just recreate it.
Code:
if (_window!=NULL)
{
SDL_GL_DeleteContext(_glcontext);
SDL_DestroyWindow(_window);
}
...
_window = SDL_CreateWindow(title.c_str(),
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
width, height,
flags);
// Create an OpenGL context associated with the window.
_glcontext = SDL_GL_CreateContext(_window);
The problem is that after a resolution change everything gets broken like this picture, it appears it’s calling the wrong context or something. Can someone help me?
Ah, stupid me. I was reseting them but before doing the actual window resize, so values where getting broken. #facepalm.
It works but now I have another problem.
I can’t change resolution from the moment I choose a window size with fullscreen. On window mode it changes fine.
After using the SDL_SetWindowSize. Fullscreen seems to get stuck on the first resolution passed in fullscreen.
I’m checking the window size after the operation via SDL_GetWindowDisplayMode and the resolution always stays the same in fullscreen------------------------ @DJ_Link