|
From: Alexander R. <a_r...@in...> - 2000-11-20 02:23:37
|
Hi,
I wanted to say that I'm already a member on sgl-dev mailing-list, so
you don't need to mail it to be and the list :-)
Scott McMillan wrote:
>
> > first thanks *a lot* for modifying the fleet_scene_* files I sent you,
> > that was more than I expected :-))))
>
> I am sure that what I gave you is not complete yet. Today, I have
For me, it was hell-of-a-lot feedback :-)
> finally gotten around to downloading plib-1.3.1 and building
> it and trying to write the SSG equivalent to testLoaders. It
> has been an enlightening experience which required wandering
> through Steve's code trying to figure out what is different.
Exactly!
That's why currently the progress of TuxFleet has a bit stopped, to look
around and browse through other projects to see and learn :-)
> > In attachment the modified/compiling version of these files.
> > I also attached the plib-ssg version of TuxFleet for comparison.
> >
> > But no 3D models get drawn on the screen yet :-(
>
> I believe this has something to do with the fact that internally
> plib rotates the camera matrix by a rotation of 90 degrees
> about the X-axis (I don't know whether it is positive or
> negative -- depends on your point of view)....read on for
> more details.
Yes I know - I had this behaviour already when writing FleetScene3dtk
for lib3dtk (3D on top of GGI), there the problem isn't solved yet.
But I 'turned' my ship all around, and in no diretion anything was
visible, if it was just the camera rotation, I would have seen the
spaceship I am heading to after I rotate round, but nothing anywhere at
all.
> > Which exactly?
>
> maybe testStatelets (was testGeoState), but it could probably
> use some simplifying as well. What I gave you should be as
> simple as it gets. I hope what I gave you works like I think
> it should.
We are getting closer ...
> > > example what does it mean to "setup the ith light", are fov's
> >
> > In setupLight I try to set them all to off, to switch them on back later
> > in setLight ... setupLight is just an old kludge to test something.
>
> That sglLight class should give you a good start on a replacement
> for PLIB's lights. Note, that all ssgLights are infinite lights.
> It does not appear that you can set the 4th component of the lights,
<cough> (GL-newbie question) What is the 4th component of the lights?
> and they are initialized to zero.
? see below
> > > in radians, are fov values half field values, how are the
> >
> > The FOV is given in degrees, fov_x=45 means you can see 45 degrees left
> > and 45 degrees right.
>
> That's a half field value, so in my code you would have to set an
> fov_x of 90 to get this behaviour.
I'll try that one.
> >
> > > lights supposed to behave? etc. etc.
> >
> > The lights are turned on and positioned in setLight, their position is
> > given in absolute coordinates, they should shine a ball of light in all
> > directions.
>
> As I said above, I believe all PLIB lights are infinite which means
> the light comes in one direction from a position an infinite distance
> away.
<scratch my head> I am more a GL-newbie, so I don't know the correct
terms etc., but:
I thought a plib light would be a sphere of light shining off from the
given position in all directions (unless set to headlights, which I
don't do) - and the light doesn't get weaker, I think.
To setup lights in TuxFleet, I only use plib calls, so if there's
anything that plib does automatically and sgl not - there could be a
problem.
I usually set the lights at coordinates x=50000 y=-500000 z=50000 (to
resemble a far away sun - the light source should be like a sun) with
following parameters for the each sun:
color sun_ambient 0.7 0.7 0.7 1.0
color sun_diffuse 1e-3 1e-3 1e-3 1.0
color sun_specular 1e-20 1e-20 1e-20 1.0
Are my lights too weak? Too far away?
> > > this is the case, then you do not really need the zup_camera.
> >
> > Aah - I got confused because in the testLoaders example you were using a
> > view_matrix as well a Polar-Camera.
>
> I use the cameras in sglu as motion models that set the
> appropriate GL_MODELVIEW_MATRIX when applyView is called).
> Currently, SGL depends on GL's modelview matrix being set before
> draw is set. This same matrix is passed into the cull function.
>
> They are not equivalent to the ssgContext which also handles the
> projection matrix.
>
> When you call ssgCullAndDraw(root_node) in PLIB. It accesses
> the current ssgContext to set the GL_PROJECTION_MATRIX, and
> the GL_MODELVIEW_MATRIX. You will have to do these by explicitly
> before you cull and draw an SGL scene graph.
Aha, there's another problem too - this will probably be for all parts
of FleetScene, when plib does something automatically in background
while in sgl you have to write some additional openGL calls yourself.
Can be solved :-)
> The real pain, is that Steve Baker pre-multiplies the modelview
> matrix by a rotation of 90-degrees about the x-axis. It is a
> standard procedure in the vissim world, but one which I absolutely
> detest.
I had that camera problem with lib3dtk before, but I am so much a
math-looser that I didn't want to do it myself, I would have taken hours
for that to fiddle out.
I'll try the code later.
> I hope this helps,
Let's see ... :-)
One more comment:
What about scaling of objects?
I do the scaling inside TuxFleet myself, the matrix I pass to plib is
already scaled correctly.
Do I have to scale the objects differently with SGL?
<after 15 mins of work with the code you sent me>
So far so good!
When I start TuxFleet now (see code in attach), I still see no ships on
the main display - but I have a 'Hud_Target_Camera', that is a small
window on the full screen that displays the targetet ship in close-up -
and THAT works!
In the normal display - no ships.
But in the camera-display, the ships are correctly like they should be,
they are even rotating, so it seems to work!
I dunno yet why it doesn't work on the main display, too tired now to
find that out, but I'm doing some additional openGL calls in that
Hud_Camera code, so I'll find out tomorrow :-)
I also had a look at the demo models with sgl (with testLoaders):
I didn't see textures on these models (and I didn't find *.obj with
textures on it in my collection), so can you make me a demo *.obj file
with textures to download or a place where to find?
Alex
--
Alexander Rawass
Email: ale...@us...
Project Homepage: http://tuxfleet.sourceforge.net
...but some day you'll be a STAR in somebody else's SKY... |