Ok, I somehow got it to work:
added the following lines to /src/main/renderer.cxx (somewhere in the
class SGPuDrawable block)
stateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON);
stateSet->setMode(GL_LIGHT0, osg::StateAttribute::ON);
stateSet->setMode(GL_LIGHT1, osg::StateAttribute::ON);
stateSet->setMode(GL_LIGHT2, osg::StateAttribute::ON);
stateSet->setMode(GL_LIGHT3, osg::StateAttribute::ON);
stateSet->setMode(GL_LIGHT4, osg::StateAttribute::ON);
recompiled flightgear and changed the parameters in the lighting file to
GL_LIGHT4 and light_num 4, and it works: I have ambient light and some
sort of spotlight (wich I had to adjust a bit) now.
Not sure if it breaks anything, was just a quick shot ;-)
fly on,
markus
Markus Zojer wrote:
> Hi there!
>
> Maybe I missed something, but under OSG/opengl it should be able to
> create up to 8 light sources.
>
> I used some simple osg code to generate a spotlight but it works only if
> I define it as light_num 0, which corresponds the GL_LIGHT0 of opengl I
> suppose, and this setting causes generic lightning to dissappear.
>
> Now some questions to someone with more insight into OSG:
> Is it possible to add lights when modifying the code below or is there a
> current limitation in flightgear that prevent lights from being added?
> I had a quick look into renderer.cxx and it seems that our global
> lighting is linked with osg there, but I am no programmer and I don't
> know how our lighting system actually works.
>
> Here the code I used (when GL_LIGHT1 and light_num 1 were used,nothing
> appeared):
> LightSource {
> UniqueID LightSource_2
> DataVariance STATIC
> nodeMask 0xffffff
> cullingActive FALSE
> StateSet {
> DataVariance STATIC
> rendering_hint DEFAULT_BIN
> renderBinMode INHERIT
> GL_LIGHTING ON
> GL_LIGHT0 ON
> GL_DEPTH_TEST ON
> }
> referenceFrame RELATIVE
> Light {
> UniqueID LightSource_3
> DataVariance STATIC
> light_num 0 //0 works but global light turned off
> ambient 0.2 0.2 0.2 1
> diffuse 1 1 1 1
> specular 0 0 0 0
> position 0 0 0 1
> direction -1 0 0
> constant_attenuation 1
> linear_attenuation 0
> quadratic_attenuation 0
> spot_exponent 2
> spot_cutoff 15
> }
> num_children 0
> }
>
> fly on,
> markus
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Flightgear-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel