[Plib-users] callbacks
Brought to you by:
sjbaker
From: Tinoshi K. <ti...@li...> - 2005-09-28 23:42:40
|
Hello!!! I want to draw an object (loaded from an .ac file) in wireframe. I want = this to be the only object in wireframe of the scene. How can I do? I've = tried to use setCallback and stuff, but even if it seems to set up the = callback properly, nothing happens... In my callback I've first called = just glPoligonMode(GL_CULL_FACE,GL_LINE), then following the viewer = example, I used: static int setWireframe(ssgEntity *e) { //glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE); if ( e -> isAKindOf ( ssgTypeLeaf() ) ) { ssgLeaf* leaf =3D (ssgLeaf*) e ; leaf -> drawHighlight ( red ) ; } return 1 ; } static int setFlat(ssgEntity *e) { //glPolygonMode ( GL_FRONT_AND_BACK, GL_FILL); return TRUE; } void Aeroplane::wire_update ( ssgEntity *e) { if ( e -> isAKindOf ( ssgTypeBranch() ) ) { ssgBranch *br =3D (ssgBranch *) e ; =20 for ( int i =3D 0 ; i < br -> getNumKids () ; i++ ) wire_update ( br -> getKid ( i ) ) ; } else if ( e -> isA ( ssgTypeLeaf() ) ) { ssgLeaf* leaf =3D (ssgLeaf *) e ; leaf -> setCallback ( SSG_CALLBACK_PREDRAW, setWireframe) ; } } I'm programming in C++, and all the examples I've seen are projects with = just main.cpp, so maybe I did a wrong initialization? in class Aeroplane.h: ssgCallback setWireframe; ssgCallback setFlat; void wire_update ( ssgEntity *e); The strange thing is that wire_update executes leaf -> setCallback ( = SSG_CALLBACK_PREDRAW, setWireframe) ; just 7 times... My .ac model is = very big, I think that is not possibile... something's wrong isn't it? The Entity i pass to void Aeroplane::wire_update ( ssgEntity *e) is the = one returned by ssgLoadAC()... HELP!!! and thank you very much!!!! |