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 2 of 2

Thread: In example 1.3 of Redbook i have a question

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    1

    In example 1.3 of Redbook i have a question

    I am just wondering how the spindisplay spins the display by putting glutpostredisplay and glutIdleFunc in the mouse function which is used as a parameter with glutMouseFunc(mouse)?

    the whole code is at the buttom of this link: http://www.glprogramming.com/red/chapter01.html

    im an intermediate level programmer in c i have not programmed in opengl at all but i am interested and eager to learn.

    The new stuff to me that blows me away is a function that has a parameter as a function.

    but in this case i just want to know how spindisplay works with all the glCalls

    I hope anyone here can Help

    thanks
    Kilopopo

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: In example 1.3 of Redbook i have a question

    glutIdleFunc sets a function to be called when glut main loop finds no event in the event queue, so it gets called almost continuously. When set to NULL, it is disabled :
    http://www.opengl.org/resources/libr...c3/node63.html

    glutPostRedisplay adds a "please redisplay" event in the glut event queue, and when glut main loop will find this event, it will call the function defined with glutDisplayFunc :
    http://www.opengl.org/resources/libr...c3/node20.html

    (not much to do with actual OpenGL programming, this is more generic event-driven programming)

Posting Permissions

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