[Plib-users] R: setTransform scaling problem
Brought to you by:
sjbaker
From: Paolo L. <p.l...@ci...> - 2009-05-27 16:06:38
|
Harald, > -----Messaggio originale----- > Da: ha...@th... [mailto:ha...@th...] > Inviato: mercoledì 27 maggio 2009 14.12 > A: pli...@li... > Oggetto: [Plib-users] setTransform scaling problem > > Hello > > I want to scale the tux from the tuxexample demo. > (plib-examples-1.8.5) I change the setTransform function to > scale the tux. > The tux is not correct drawing. I tink the recalculating of > the bounding box for viewing have a bug. What is wrong in the way SSG draws it? Please supply more information. > I am using linux and plib 1.8.5 > (i have the same problem in my own project) > > static void update_motion () > { > static int frameno = 0 ; > > frameno++ ; > > sgCoord campos ; > sgCoord tuxpos ; > > /* > Spin Tux, make the camera pan sinusoidally left and right > */ > > sgSetCoord ( & campos, 0.0f, -5.0f, 1.0f, 24.0f * > (float)sin(frameno/100.0), 0.0f, 0.0f ) ; > sgSetCoord ( & tuxpos, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, > frameno/100.0f ) ; > > ssgSetCamera ( & campos ) ; > // penguin -> setTransform ( & tuxpos ) ; // from > penguin -> setTransform ( & tuxpos ,10.0f,10.0f,10.0f) ; // to } So the tux is at (0,0,0), the camera is at (0,-5,1). When you scale the tux by ten times (i.e. the tux is ten time larger), assuming its original size is in the order of magnitude of 1, the camera is now actually inside the tux and, with back face culling active (the default in the ssgState and in SSG), you shouldn't see almost anything else but some reentrant surface if the tux model is not convex. If this is the drawing problem you are experiencing try to move the camera ten units more far from the current position, e.g. try (0,-15,1) or even farther. > thank you > > Harald Pichler Let us know. Greetings, Paolo Leoncini |