Results 1 to 4 of 4

Thread: forcing a display redraw using signals

  1. #1
    Guest

    forcing a display redraw using signals

    I have a multi-threaded app in which one thread handles the openGL display, and the other handles the GUI to the user. When the user changes something in the GUI, I need the openGL thread to regen the display. Is there a way to signal GLX that I want to regen the screen? Right now I'm using a clunky method of using a timer func to check a flag set by the GUI thread. The method works, but it's not very efficient.

  2. #2
    Member Contributor
    Join Date
    Feb 2002
    Location
    Wiesbaden, Germany
    Posts
    95

    Re: forcing a display redraw using signals

    hi,

    I would implement an interface function between the OGL thread and the GUI thread. The GUI sets the flag and invokes a redraw.
    Actually pretty simple, have a look at semaphores. I assume you are coding Linux right?

    Martin

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: forcing a display redraw using signals

    I donīt know what you are writing.
    If you are writing an editor, or so, than i understand, that you donīt want many redraws. In this case you should just make a while loop, that checks for a boolean variable (inside your draw-thread). If it is true, redraw your scene, and set the variable to false.
    In your app-thread (GUI-thread) just set the variable to true, when you want a redraw.
    (In the while-loop you should use "Sleep (50);" so that the thread doesnīt use too much processingtime.)

    If you are programming a game, or some other realtimeapplication, you should just draw your scene as often as possible (at least 30 times a second). You have to do this to get the "realtime" and animations, etc. And as a sideeffect you never have to bother about redraws

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  4. #4
    Guest

    Re: forcing a display redraw using signals

    If you go for the while loop is a condition variable much to prefer because it let you wait without any delay or wasted CPU cycles. Here is some information http://users.actcom.co.il/~choo/lupg...thread_condvar

Similar Threads

  1. Forcing GL to draw
    By Ferenzzy in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-27-2005, 04:35 AM
  2. Forcing the depth value
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-20-2005, 06:11 AM
  3. 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
  4. display data from file (redraw)
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-13-2002, 03:57 PM
  5. Forcing a redisplay
    By pjbibby in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 03-09-2001, 02:28 AM

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