I am using PHIGS to draw 3D objects in a Tk canvas widget and manipulate
them (I need those 3D objects and rotation for my application -
no offense meant to Tk's capabilities).
I have added an eventhandler to the canvas widget to handle
expose and configurenotify events as suggested by Dr. Ousterhout in his book.
On receiving the expose event, PHIGS handles the redrawing of all the
objects. I have disabled backingstore (don't want it). I am OK up to this
point. But as soon as PHIGS finishes redrawing, Tk appears to restore the
canvas as well. With the result, the objects disappear (and there is no
expose event to redraw them) or messed up. This appears to be a timing problem
because if I refresh my entire screen from the window manager utilities, the
objects reappear as they should and this time they stay.
Here are the bits of code
________________________________________________________________________
dsp= Tk_Display(win);
winid = Tk_WindowId(win);
/*Ask PHIGS not to monitor events*/
mask = PXPHIGS_INFO_FLAGS_NO_MON;
xphigs_info.flags.no_monitor =1;
/*Set uup the PHIGS connection id struct*/
conn_id.display = dsp;
conn_id.drawable_id = winid;
/*Open PHIGS*/
popen_xphigs (PDEF_ERR_FILE,PDEF_MEM_SIZE,mask,&xphigs_info);
/*Unet backingstore */
win_attrs.backing_store = NotUseful;
XChangeWindowAttributes(dsp, winid, CWBackingStore, &win_attrs);
/*Add an event handler to the canvas widget to handle exposure & configure
notify events*/
Tk_CreateEventHandler(win,ExposureMask|StructureNotifyMask,
(Tk_EventProc *) redrawProc,NULL);
/*Event proc*/
int redrawProc (ClientData clientdata, XEvent *evptr)
{
if (evptr->type == Expose) {
if(evptr->xexpose.count == 0)
predraw_all_structs(WS_ID,PFLAG_ALWAYS);
return 0;
}
}
_____________________________________________________________________
Any help from Tk/X/PHIGS gurus via email will be gratefully received.
Many thanks in advance.
Lakshmi Sastry,
CISD,
RAL.
email: l...@inf.rl.ac.uk