Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Rendering stops when I click title bar?

  1. #1
    Intern Contributor
    Join Date
    May 2011
    Posts
    56

    Rendering stops when I click title bar?

    Okay, so, I had a problem where whenever I tried to resize or move my window, rendering would halt. Which was weird, because my Render() function isn't in WndProc at all, it's in my main loop. I partially solved this by having WM_SIZE and WM_MOVE both call the Render() function, but the animation still stops whenever I click on the title bar or on the border of the window. I've been hunting for what message windows sends when it does this, as WM_ENTERSIZEMOVE is the closest I got, but that only gets sent once, not every frame like WM_MOVE or WM_SIZE. I tried making WM_ENTERSIZEMOVE turn on a bool that tells WndProc whether or not to render, but that just didn't work at all. The main reason that this is an issue is because while the animation stops, the music (playing via OpenAL) does not, which could easily cause sync issues down the line.

    I could make it so that the programs is suspended whenever focus of the window is lost, which I presume would be any case that would get in the way of rendering, but I'd much rather just make it keep rendering no matter what the user is doing (unless they're in another window - I already check for that via WM_ACTIVATE).

    (I apologize, this probably isn't an OpenGL-specific question, but it's been bugging me nonetheless).

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,261

    Re: Rendering stops when I click title bar?

    Investigate the WM_NC*** messages. This behaviour is kinda normal (freezes window while you hold mouse button on title-bar, and haven't moved the mouse since that button-press), and so far I've only seen it solved if you don't have a titlebar.

  3. #3
    Intern Contributor
    Join Date
    May 2011
    Posts
    56

    Re: Rendering stops when I click title bar?

    Nada, I went through pretty much all of the windows messages I could find. I know there's a way to do this, I just don't know how to find it...

    I've even tried this, to no avail:
    Code :
    	case WM_SIZE:
    		ChangeSize(LOWORD(lParam), HIWORD(lParam));
    	case WM_SIZING:
    	case WM_MOVE:
    	case WM_MOVING:
    	case WM_NCCALCSIZE:
    		Render();
    		break; //WM_SIZE

  4. #4
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: Rendering stops when I click title bar?

    Really the best solution is to use separate threads : one for rendering and another to update game logic.

  5. #5
    Intern Contributor
    Join Date
    May 2011
    Posts
    56

    Re: Rendering stops when I click title bar?

    Truth is, I was planning to multithread anyway, for file i/o mainly. Could you point me towards a good opengl multithreading reference? Or multithreading in general - I hear opengl itself isn't good with threads, but that's no reason not to multithread the rest of the game.

    Anyways, either way, the rendering will still have to be done in a window - how will multithreading solve an issue caused by the window?

  6. #6
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,728

    Re: Rendering stops when I click title bar?

    Anyways, either way, the rendering will still have to be done in a window - how will multithreading solve an issue caused by the window?
    Because if Windows doesn't want your GUI thread to get a timeslice, then it doesn't get a timeslice. But if the game logic is in another thread, at least you can keep the game logic going, so that when Windows lets you draw stuff again, time will have properly passed.

  7. #7
    Intern Contributor
    Join Date
    May 2011
    Posts
    56

    Re: Rendering stops when I click title bar?

    Darn Windows <.<

    Oh well, thanks for the tip. Know where I can get started?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •