icetDrawFunc(3) set a callback for drawing.

Synopsis

#include <GL/ice-t.h>

typedef void (*IceTCallback)(void);

void icetDrawFunc(IceTCallbackfunc );

Description

The icetDrawFunc function sets a callback that is used to draw the geometry from a given viewpoint.

func should be a function that issues appropriate OpenGL calls to draw geometry in the current OpenGL context. After func is called, the image left in the back frame buffer will be read back for compositing.

func should not modify the GL_PROJECTION_MATRIX as this would cause IceT to place image data in the wrong location in the tiled display and improperly cull geometry. It is acceptable to add transformations to GL_MODELVIEW_MATRIX, but the bounding vertices given with icetBoundingVertices or icetBoundingBox are assumed to already be transformed by any such changes to the modelview matrix. Also, GL_MODELVIEW_MATRIX must be restored before the draw function returns. Therefore, any changes to GL_MODELVIEW_MATRIX are to be done with care and should be surrounded by a pair of glPushMatrix and glPopMatrix functions.

It is also important that func not attempt the change the clear color. In some composting modes, IceT needs to read, modify, and change the background color. These operations will be lost if func changes the background color, and severe color blending artifacts may result.

IceT may call func several times from within a call to icetDrawFrame or not at all if the current bounds lie outside the current viewpoint. This can have a subtle but important impact on the behavior of func. For example, counting frames by incrementing a frame counter in func is obviously wrong (although you could count how many times a render occurs). func should also leave OpenGL in a state such that it will be correct for a subsequent run of func. Any matrices or attributes pushed in func should be popped before func returns, and any state that is assumed to be true on entrance to func should also be true on return.

Errors

None.

Warnings

None.

Bugs

None known.

Notes

func is tightly coupled with the bounds set with icetBoundingVertices or icetBoundingBox. If the geometry drawn by func is dynamic (changes from frame to frame), then the bounds may need to be changed as well. Incorrect bounds may cause the geometry to be culled in surprising ways.

Copyright

Copyright (C)2003 Sandia Corporation

Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive license for use of this work by or on behalf of the U.S. Government. Redistribution and use in source and binary forms, with or without modification, are permitted provided that this Notice and any statement of authorship are reproduced on all copies.