Results 1 to 2 of 2

Thread: Question about redraw()

  1. #1
    Member Newbie
    Join Date
    Feb 2003
    Stony Brook, NY

    Question about redraw()

    I am specifically using FLTK redraw() function but I believe this question can be extended to GLUI,GLUT...
    Why is it that I need an event to happen to be able to call a redraw of the screen? Let me explain better. If I am reading the state of the mouse and for each even coming from the mouse (for instance a move of the mouse) I update the screen and ask for redraw, this works fine.
    Why can't I do the same making a loop and asking a redraw at the end of each loop? It would be so much easier and intuitive.
    Can anyone elaborate on this issue and explain me what is the reason that redraw happens successfully only after events?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001

    Re: Question about redraw()

    Hi !

    Because it all runs in one single thread normally, and that means that as long as you are in the loop you will not be able to redraw the OpenGL contents, the redraw is called when the main thread returns to the internal message handler and does not have any important messages pending, it will not redraw antthing until you exit the loop.

    There are ways around this, for example on windows you could call InvalidateRect(...); UpdateWindow(...) to force a redraw of the window contents in he loop.

    Another way is to put your code in a thread outside the main message thread, but I do not remember if Fltk has threading support.



Similar Threads

  1. Optimizing redraw
    By AngelT in forum OpenGL: Windows
    Replies: 2
    Last Post: 12-07-2004, 09:37 AM
  2. Redraw
    By gallicox in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-04-2003, 09:05 AM
  3. Command to redraw?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-19-2003, 11:28 PM
  4. How to redraw some objects while not redraw others?
    By ding in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 09-28-2002, 09:25 AM
  5. picking and redraw question
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-29-2000, 08:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean