stranging fickering with sdl/opengl

Started by
2 comments, last by vurentjie 16 years, 1 month ago
hi, i have a strange display problem, i first noticed the problem with my own code, but compiling other code gives the same results, i am using using sdl_opengl to drawn with opengl functions, basically any sdl prog that i run on my machine that uses sdl_opengl causes strange flickering to happen, the first time i noticed this was when a windows update reminder popped up from my bottom taskbar, where this pop-up overlapped with my own program window it flickered wildly, also if i click 'start' on the bottom windows taskbar and the 'start' main menu pops up, the drop shadow effect along its edges also flickers madly where it overlaps my sdl window, this only happens with calls to sdl_opengl, otherwise it handles fine, i don't know if anybody else has encountered this before, perhaps it has something to do with my pc setup, or maybe it is something to do with sdl, i don't know, if anyone knows anything about this please tell.
Advertisement
Have you enabled vsync?

SDL_GL_SetAttribute(SDL_GL_SWAPCONTROL,1)

Put that before SDL_SetVideoMode()

Note: Vsync can be ignored by the video card if the user has configured the settings as such.
Do you use double-buffering?

    // initialise    const SDL_VideoInfo *video_info = SDL_GetVideoInfo();    if (!video_info)    {        fatal << "could not get video information" << POS;        quit();    }    flags = SDL_OPENGL | SDL_RESIZABLE | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE;    if (video_info->hw_available)    { flags |= SDL_HWSURFACE; }    else    { flags |= SDL_SWSURFACE; }    if (video_info->blit_hw)    { flags |= SDL_HWACCEL; }    screen = SDL_SetVideoMode(width, height, depth, flags);    if (!screen)    {        fatal << "could not create video mode" << POS;        quit();    }    // more loading    bool running = true;    while (running)    {        // event checking / drawing        SDL_GL_SwapBuffers();    }
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
ok, thanks for the replies,
i have found the cause of my problem and well it does entail glSwapBuffers, it is not because i haven't included it, but basically i found my solution by trying all different gl libs, sdl,sfml,glfw, then eventually a bit of advice from someone, and then checking the manual for glfw at least....which says

Quote:
There are two ways to handle events in GLFW:
Block the event loop while waiting for new events.
Poll for new events, and continue the loop regardless if there are any new events or not.
The first method is useful for interactive applications that do not need to refresh the OpenGLTM display
unless the user interacts with the application through user input. Typical applications are CAD software
and other kinds of editors.
The second method is useful for applications that need to refresh the OpenGLTM display constantly,
regardless of user input, such as games, demos, 3D animations, screen savers and so on.

so basically i need to know how i halt the event loop, but don't exit the program... i would guess in SDL i could not use while(SDL_PollEvent(&event)) as this is continually polling for events...but i am totally unsure here...going to have to fiddle some more.

This topic is closed to new replies.

Advertisement