Some callbacks are single function pointers. Assigning your own function to these pointers will remove the default value.
Others are array of functions. For those, you must first obtain an ID so that you can assign your function to the appropriate slot in the array. To obtain this ID, you must define the following function in your module, if it exist, sliceOmatic will call the your function with an array of IDs as parameter. You can select the IDs you need and return a flag indicating which ID you used so that sliceO can increment them.
Syntax
extern "C" __declspec(dllexport) unsigned short Callback_Get_ID(
unsigned short *id
)
Parameters
id
Array of Indexes to use in the callback array. This value will be provided by SliceOmatic when it call your function.
Return value
This function return a bit flag indicating which index has been used.
Remarks
Requirements
Header:
sliceO_include.hpp
Library:
sliceO_Structures.lib
Example
Getting an ID for the "Draw_OpenGL" callback
static unsigned short Local_Callback_ID ;
// ----------------------------------------------------------------------------
//
// Function: Callback_Get_ID...
//
// Parameters: id (unsigned short) // callback id assigned to the DLL
// Returns: (void)
//
// These function should only exist if the DLL plan to use one of the
// following callcbacks:
// in SliceO_Class
// Fct_Draw_3D[]()
// Fct_Draw_OpenGL[]()
// Fct_Draw_Stencil[]()
// in SliceO_Geom
// Fct_Draw_Geom[]()
// in SliceO_Frame
// Fct_Update_GLI_Disp[]()
// Fct_Update_TAG_Disp[]()
//
// SliceOmatic will use this function at start-up to assign a unique
// ID number to your DLL.
//
// ----------------------------------------------------------------------------
extern "C" __declspec(dllexport) unsigned short Callback_Get_ID( unsigned short *id )
{
Local_Callback_ID = id[CALLBACK_DRAW_OPENGL] ;
return( 1 << CALLBACK_DRAW_OPENGL ) ;
}
|
|
Getting an IDs for both the "Draw_Base" and "Update_TAG" callback
unsigned short Local_Callback_ID_Base ;
unsigned short Local_Callback_ID_TAG ;
// ----------------------------------------------------------------------------
//
// Function: Callback_Get_ID
//
// Parameters: id (unsigned short) // Array of callback IDs
// Returns: (unsigned short) // bit mask of used IDs in the array
//
// This function should only exist if the DLL plan to use one of the
// following callcbacks:
// in SliceO_Class
// Fct_Draw_3D[]()
// Fct_Draw_OpenGL[]()
// Fct_Draw_Stencil[]()
// in SliceO_Geom
// Fct_Draw_Geom[]()
// in SliceO_Frame
// Fct_Update_GLI_Disp[]()
// Fct_Update_TAG_Disp[]()
//
// SliceOmatic will use this function at start-up to assign a unique
// ID number to your DLL.
//
// ----------------------------------------------------------------------------
extern "C" __declspec(dllexport) unsigned short Callback_Get_ID( unsigned short *id )
{
Local_Callback_ID_Base = id[CALLBACK_DRAW_BASE] ;
Local_Callback_ID_TAG = id[CALLBACK_UPDATE_TAG] ;
return( (1 << CALLBACK_UPDATE_TAG)
|| (1 << CALLBACK_DRAW_BASE) ) ;
}
|
|
See also