glutDisplayFunc

sets the display callback for the current window.

Signature

glutDisplayFunc( )-> void
glutDisplayFunc( function )
Specify handler for GLUT 'Display' events
    def handler(  ):
        return None

Parameters

VariablesDescription
func
The new display callback function.

Description

glutDisplayFunc sets the display callback for the current window. When GLUT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called. Before the callback, the current window is set to the window needing to be redisplayed and (if no overlay display callback is registered) the layer in use is set to the normal plane. The display callback is called with no parameters. The entire normal plane region should be redisplayed in response to the callback (this includes ancillary buffers if your program depends on their state).
GLUT determines when the display callback should be triggered based on the window's redisplay state. The redisplay state for a window can be either set explicitly by calling glutPostRedisplay or implicitly as the result of window damage reported by the window system. Multiple posted redisplays for a window are coalesced by GLUT to minimize the number of display callbacks called.
When an overlay is established for a window, but there is no overlay display callback registered, the display callback is used for redisplaying both the overlay and normal plane (that is, it will be called if either the redisplay state or overlay redisplay state is set). In this case, the layer in use is not implicitly changed on entry to the display callback.
See glutOverlayDisplayFunc to understand how distinct callbacks for the overlay and normal plane of a window may be established.
When a window is created, no display callback exists for the window. It is the responsibility of the programmer to install a display callback for the window before the window is shown. A display callback must be registered for any window that is shown. If a window becomes displayed without a display callback being registered, a fatal error occurs. Passing NULL to glutDisplayFunc is illegal as of GLUT 3.0; there is no way to "deregister" a display callback (though another callback routine can always be registered).
Upon return from the display callback, the normal damaged state of the window (returned by calling glutLayerGet(GLUT_NORMAL_DAMAGED) is cleared. If there is no overlay display callback registered the overlay damaged state of the window (returned by calling glutLayerGet(GLUT_OVERLAY_DAMAGED) is also cleared.

See Also

glutCreateMenu glutPostRedisplay glutOverlayDisplayFunc

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glutDisplayFunc
OpenGLContext OpenGLContext/glutcontext.py Lines: 85, 87, 137
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 165
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 277
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 203
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson41.py Lines: 335
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 186
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 246
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 215
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 167
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 232
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 166
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson3.py Lines: 144
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 197
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson1.py Lines: 117
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson19.py Lines: 258
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 405
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson2.py Lines: 139
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 241
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 487
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson48/NeHeGL.py Lines: 142
OpenGL-Demo PyOpenGL-Demo/proesch/nurbs/nurbs.py Lines: 205
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 103
OpenGL-Demo PyOpenGL-Demo/GLE/maintest.py Lines: 32, 37
OpenGL-Demo PyOpenGL-Demo/GLUT/gears.py Lines: 271
OpenGL-Demo PyOpenGL-Demo/GLUT/shader_test.py Lines: 129
OpenGL-Demo PyOpenGL-Demo/GLUT/glutplane.py Lines: 220
OpenGL-Demo PyOpenGL-Demo/GLUT/molehill.py Lines: 175
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/conesave.py Lines: 53
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/checker.py Lines: 111
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/lorentz.py Lines: 120
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 98
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/text.py Lines: 112
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 113
OpenGL-Demo PyOpenGL-Demo/redbook/hello.py Lines: 100
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 140
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 113
OpenGL-Demo PyOpenGL-Demo/redbook/lines.py Lines: 139
OpenGL-Demo PyOpenGL-Demo/redbook/movelight.py Lines: 137
OpenGL-Demo PyOpenGL-Demo/redbook/smooth.py Lines: 107
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 155
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 111
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 205
OpenGL-Demo PyOpenGL-Demo/redbook/cube.py Lines: 96
OpenGL-Demo py2exe-example/shader_test.py Lines: 131
{Artistic License} PymmLib pymmlib/applications/glutviewer.py Lines: 404
{LGPL} PyUI2 renderers/openglGlut.py Lines: 168, 171
{LGPL} PyUI2 system/glutdevice.py Lines: 77
{LGPL} PyMT pymt/ui/window/win_glut.py Lines: 17, 97
{GPL3} OpenGL-Programmable 05-shader.py Lines: 314
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 333
{GPL3} OpenGL-Programmable 03-array.py Lines: 234
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 376
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 322
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 386
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 232
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 253
{GPL3} OpenGL-Programmable 01-direct.py Lines: 223
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 355