Path: utzoo!attcan!uunet!jarthur!usc!zaphod.mps.ohio-state.edu!mips!sgi!shinobu!odin!cashew.asd.sgi.com!kurt From: kurt@cashew.asd.sgi.com (Kurt Akeley) Newsgroups: comp.sys.sgi Subject: Re: libsphere - how do I get a sphere into an object? Message-ID: <1990Nov5.163639.12230@odin.corp.sgi.com> Date: 5 Nov 90 16:36:39 GMT References: <10445@milton.u.washington.edu> Sender: news@odin.corp.sgi.com (Net News) Reply-To: kurt@cashew.asd.sgi.com (Kurt Akeley) Distribution: comp.sys.sgi Organization: sgi Lines: 41 In article <10445@milton.u.washington.edu>, merritt@milton.u.washington.edu (Ethan Merritt) writes: |> I have been playing with libsphere on a PI under 3.3.1. I like it, |> but I haven't been able to figure out how to get spheres into a graphics |> object. The example in 4Dgifts/src/sphere doesn't use objects, so that |> hasn't helped. |> |> The simple-minded approach: |> makeobj( sphere_object ); |> sphdraw( ¶ms[i] ); |> closeobj(); |> produces nothing when the corresponding callobj( sphere_object ) is done. |> |> The library routine sphobj() looks relevent, but the documentation is, |> shall we say, terse. Calling sphobj( sphereobj ) seems to draw a sphere |> into sphereobj all right, but always at the origin (I think). Anyway |> preceding the call with a move( x,y,z ) call seems to have no effect. |> I.e.: |> sphobj( sphere_object ); |> makeobj( spheres ); |> for (i = 0; i < nspheres; i++ ) |> { |> move( &xyz[i] ); |> callobj( sphere_object ); |> } |> closeobj(); |> callobj( spheres ); |> doesn't seem to do anything other than pile up spheres on top of each other. |> |> Can anyone enlighten me? You're almost there, but you dropped the ball by calling move() to reposition the spheres. The way to reposition any GL object, including the sphere objects, is to redefine the object-to-eye coordinate transformation by calling translate(). Just replace your move() call with a translate() call and things should work well. Sorry for the terse documentation. Just another case of something that seemed obvious to us, but is not to others. -- kurt