Hello,
I have a (not that) small GL code that displays a circle around the cursor. The circle regularly hangs when moving the mouse, unless I request a surface, in which case, it’s completely smooth, no lag/hangs/stops whatsoever.
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 2 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
_sdl_window = SDL_CreateWindow (
_window->title ()->get_value ().c_str(),
(int) (_window->x ()->get_value ()),
(int) (_window->y ()->get_value ()),
(int) (_window->width ()->get_value ()),
(int) (_window->height ()->get_value ()),
SDL_WINDOW_SHOWN
| SDL_WINDOW_ALLOW_HIGHDPI
| SDL_WINDOW_RESIZABLE
| SDL_WINDOW_OPENGL
);
if( _sdl_window == NULL ) {
std::cerr << "Window could not be created! SDL_Error:" << SDL_GetError() << std::endl;
return;
}
SDL_GLContext context = SDL_GL_CreateContext(_sdl_window);
if (!context) {
fprintf(stderr, "Couldn't create context: %s\n", SDL_GetError());
return;
}
//does not change anything
//SDL_GL_SetSwapInterval(1);
//Get window surface: commenting it make it run slow
_sdl_surface = SDL_GetWindowSurface( sdl_window() ); // necessary for the remaining (renderer)
assert(_sdl_surface);
The drawing part uses VBOs and array buffers.
The OpenGL renderer is: NVIDIA Corporation 2.1 NVIDIA-10.32.0 355.11.10.10.40.102
Similar topics in the forum did not enlighten me… maybe this one:
Did I miss something?
Best,
Stéphane