Re: [osg-users] 3DS loader broken for models that use pivot points?

2008-08-06 Thread Vincent Bourdier
I,
Just an idea but if you want to have a pivot point, add a Helper at the
pivot point of your model, and put it as parent of all the model...
It is not exactly what you mean, but it can do what you want.

Regards,
Vincent.


2008/8/6 [EMAIL PROTECTED]

 I have some 3DS models that I am trying to load that seem to be getting a
 bad matrix transformation that end up flattening the geometry.  According
 to a comment in the source, the 'new' method of converting 3DS files
 should be better, but have problems when pivot points are present in the
 model.  I have attached an example file that exhibits this problem.  Has
 anyone else seen this?  I am using 2.4.0

 Thanks

 Chuck Seberino
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] moving models...

2008-08-06 Thread Ulrich Hertlein

Hi Shayne,

Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC wrote:

Ok, I updated the transform node as given below for position changes and
this seems to work. However, when I add an orientation update (i.e. multiply
the translation by a rotation) my model disappears completely. Any idea on
what's going on with that? 


Two things:
- check the order of Matrix multiplicationsi.  Are you maybe rotating around global 
instead of local?  The way you describe your mults indicates it may be the former.

- is the node you're rotating modelled in the origin?

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] using shaders to find fthe maximum value in a

2008-08-06 Thread Abdallah Deeb

tx for u response Art ,

if i understand u correctly  my code will be something like this  ,i am using 
glew .
(suppose my input texture where i want  to find my maximum value is 
(width,height) and i have a FrameBuffer class and a GL_Texture class, and a 
shader.)

inputtexture=new GL_Texture(...width,height...)
n=2;
fbo=new FrameBuffer(...)

loop
{
outputexture=new GL_Texture(..width/n,height/n)

//activate fbo to render to texture 
fbo-Bind();

//attach a outputexturetexture to render to it
fbo-AttachTexture(outputexture);

//setup viewport to size of outputetexture
glViewport(0, 0,width/n,height/n);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, (GLdouble) ,width/n, 0,height/n, -30, 30);
glClearColor(0,0,0,0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

//activate inputtexture and run shader 
inputtexture-Activate(GL_TEXTURE0);
shader-begin();

//pass inputtexture to shader 
shader-setUniform1i(texture0,0);

//Here i render a Rectangle at width/n and height/n

//disable shader and fbo
shader-end();
fbo-Disable();

 //go to next step of reducing inputtexture
n*=2;

//copy outputetexture to inputtexture for next iteration : 
inputtexture=outputexture
inputtexture=GetCopy(outputexture);


delete outputexture;

}//end loop

and in the fragment shader all i have to do is : each pixel shader will 
calulate a maximum for 4 neighberhood texels  of the input texture ?
is it correct ?

thx in advance
 


 Message: 5
 Date: Tue, 5 Aug 2008 17:09:45 + (GMT)
 From: Art Tevs [EMAIL PROTECTED]
 Subject: Re: [osg-users] using shaders to find fthe maximum value in a
   texture
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=utf-8
 
 Do you need the maximum value over all texture elements?
 If yes, then you just have to compute a mipmap with max as combining 
 operation. In the last level, where only one pixel left, you will get the 
 maximum value.
 It is pretty straight forward to implement such an algorithm. 
 
 Either any GPGPU approach can help you, or if you use osg, then take a look 
 into osgPPU's hdr example.
 
 Best regards,
 Art
 
 
 --- Abdallah Deeb [EMAIL PROTECTED] schrieb am Di, 5.8.2008:
 
  Von: Abdallah Deeb [EMAIL PROTECTED]
  Betreff: [osg-users] using shaders to find fthe maximum value in a texture
  An: osg-users@lists.openscenegraph.org
  Datum: Dienstag, 5. August 2008, 16:56
  Hello, 
  i am new to glsl ,  i have a probleme ( it seems that it is
   fondamental problem in shaders) 
  in order to calculate the maximum/minumum value in a
  texture passed to fragment shader ,
  it seems that there is as special architecture to implement
  to resolve this probleme .
  i passed a days searching on the net to solve this problem
  but no one discuss this probleme and how to calculate a
  maximum or minimum in a texture or vector norm ... i heard
  something called vector reduce in shaders.. but i have no
  clear idea about it . 
  
  so in resume  my question is how can i create a fragment
  shader that can calculate (a maximum value for ex) in a
  texture passed to it ,
  
  if anyone can help me plz  , i really need an
  implementation or a reference docs.. 
  thx in advance . 
  
  


_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenSceneGraph-2.6.0 release is available!

2008-08-06 Thread Robert Osfield
Hi Mario,

On Wed, Aug 6, 2008 at 4:40 AM, Mario Valle [EMAIL PROTECTED] wrote:
 Only a minor glitch.

 www.openscenegraph.com redirects you to www.openscenegraph.org, the main OSG
 site.
 There is no way to know what Professional Services offer...
 Is it intentional?

This is a problem rather unrelated to 2.6...

A year and half ago the openscenegraph.com website was hastily
repurposed to become openscenegraph.org when we lost access to the old
server for .org.  We now have a new server for .org and it's hosted
without further problems, but... I've been so rushed off my feet I
haven't had a chance to put up a new website for openscenegraph.com.
It's on my todo list to put up a new website for my company, just
waiting for a quiet period so that I can sit down plan, put it
together etc.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Light attenuation do nothing

2008-08-06 Thread Vincent Bourdier
Hi all,

I've a scene with 2 lights :

The first one (n°0) is the one for the whole scene, with ambiant component,
diffuse, specular, ...
The second one is attached on a node, and have to light only this node and
not all the scene.

To do that, I put some attenuation on the second light to avoid it light the
reste of the scene... but it does nothing !

light1-setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
light1-setDiffuse(osg::Vec4(intensity, 0, 0, 1));
light1-setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
light1-setPosition(osg::Vec4(p1, 0));
light1-setDirection(-p1);
light1-setSpotCutoff(0.5f);
light1-setConstantAttenuation(0.95f);
light1-setLinearAttenuation(0.001f);
light1-setQuadraticAttenuation(0.0002f);

osg::LightSource* satLightSource1 = new osg::LightSource;
satLightSource1-setLight(light1.get());
satLightSource1-setLocalStateSetModes( osg::StateAttribute::ON );
satLightSource1-getOrCreateStateSet()-setMode(GL_LIGHTING,
osg::StateAttribute::ON);

osg::LightModel* lightModel1 = new osg::LightModel;
lightModel1-setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
//0,0,0,1
satLightSource1-getOrCreateStateSet()-setAttribute(lightModel1);

group-addChild(satLightSource1);

_root-getOrCreateStateSet()-setMode(GL_LIGHT1,
osg::StateAttribute::ON);

When I modify quadratic attenuation and linear attenuation, nothing appear
to be changed in the scene, and a lot of nodes are lighted in red...

Some idea why it doesn't works ?
Thanks,

Regards,
Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light attenuation do nothing

2008-08-06 Thread Robert Osfield
Hi Vincent,

You'll need to set the light number of the light via
light-setLightNum(num);  The first light should be 0, and your second
one 1.

Robert.

On Wed, Aug 6, 2008 at 10:53 AM, Vincent Bourdier
[EMAIL PROTECTED] wrote:
 Hi all,

 I've a scene with 2 lights :

 The first one (n°0) is the one for the whole scene, with ambiant component,
 diffuse, specular, ...
 The second one is attached on a node, and have to light only this node and
 not all the scene.

 To do that, I put some attenuation on the second light to avoid it light the
 reste of the scene... but it does nothing !

 light1-setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
 light1-setDiffuse(osg::Vec4(intensity, 0, 0, 1));
 light1-setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
 light1-setPosition(osg::Vec4(p1, 0));
 light1-setDirection(-p1);
 light1-setSpotCutoff(0.5f);
 light1-setConstantAttenuation(0.95f);
 light1-setLinearAttenuation(0.001f);
 light1-setQuadraticAttenuation(0.0002f);

 osg::LightSource* satLightSource1 = new osg::LightSource;
 satLightSource1-setLight(light1.get());
 satLightSource1-setLocalStateSetModes( osg::StateAttribute::ON );
 satLightSource1-getOrCreateStateSet()-setMode(GL_LIGHTING,
 osg::StateAttribute::ON);

 osg::LightModel* lightModel1 = new osg::LightModel;
 lightModel1-setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
 //0,0,0,1
 satLightSource1-getOrCreateStateSet()-setAttribute(lightModel1);

 group-addChild(satLightSource1);

 _root-getOrCreateStateSet()-setMode(GL_LIGHT1,
 osg::StateAttribute::ON);

 When I modify quadratic attenuation and linear attenuation, nothing appear
 to be changed in the scene, and a lot of nodes are lighted in red...

 Some idea why it doesn't works ?
 Thanks,

 Regards,
 Vincent.

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light attenuation do nothing

2008-08-06 Thread Vincent Bourdier
Hi Robert,

Yes I know, i forgot to paste the code :

osg::ref_ptrosg::Light light1 = new osg::Light;
light1-setLightNum(1);

Sorry

Any idea ? because the red light is visible, but no attenuation modify it...
and this is the real problem.
Thanks,

Vincent.

2008/8/6 Robert Osfield [EMAIL PROTECTED]

 Hi Vincent,

 You'll need to set the light number of the light via
 light-setLightNum(num);  The first light should be 0, and your second
 one 1.

 Robert.

 On Wed, Aug 6, 2008 at 10:53 AM, Vincent Bourdier
 [EMAIL PROTECTED] wrote:
  Hi all,
 
  I've a scene with 2 lights :
 
  The first one (n°0) is the one for the whole scene, with ambiant
 component,
  diffuse, specular, ...
  The second one is attached on a node, and have to light only this node
 and
  not all the scene.
 
  To do that, I put some attenuation on the second light to avoid it light
 the
  reste of the scene... but it does nothing !
 
  light1-setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
  light1-setDiffuse(osg::Vec4(intensity, 0, 0, 1));
  light1-setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
  light1-setPosition(osg::Vec4(p1, 0));
  light1-setDirection(-p1);
  light1-setSpotCutoff(0.5f);
  light1-setConstantAttenuation(0.95f);
  light1-setLinearAttenuation(0.001f);
  light1-setQuadraticAttenuation(0.0002f);
 
  osg::LightSource* satLightSource1 = new osg::LightSource;
  satLightSource1-setLight(light1.get());
  satLightSource1-setLocalStateSetModes( osg::StateAttribute::ON );
  satLightSource1-getOrCreateStateSet()-setMode(GL_LIGHTING,
  osg::StateAttribute::ON);
 
  osg::LightModel* lightModel1 = new osg::LightModel;
  lightModel1-setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
  //0,0,0,1
  satLightSource1-getOrCreateStateSet()-setAttribute(lightModel1);
 
  group-addChild(satLightSource1);
 
  _root-getOrCreateStateSet()-setMode(GL_LIGHT1,
  osg::StateAttribute::ON);
 
  When I modify quadratic attenuation and linear attenuation, nothing
 appear
  to be changed in the scene, and a lot of nodes are lighted in red...
 
  Some idea why it doesn't works ?
  Thanks,
 
  Regards,
  Vincent.
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] vpb build_master.source --radius-equator

2008-08-06 Thread Robert Osfield
Hi J.P,

Currently the radius settings are stored in the BuildOptions's
EllipsoidModel, it should staight forward to add the serialization of
its parameters. I'm working on VPB so I'll have a look at doing this
item.

Robert.

On Tue, Aug 5, 2008 at 3:54 PM, J.P. Delport [EMAIL PROTECTED] wrote:
 Hi,

 when setting the values --radius-equator and --radius-polar, the values in
 the ellipsoidmodel are set in vpb, but they are not written to the
 build_master.source file.

 So, when doing a distributed build, these options get discarded when osgdem
 reads the .source file.

 I am still trying to get my head around how the parsing of the .source file
 works.

 Would a fix be as easy as adding the options to the BuildOptions and
 BuildOptionsIO files?

 I need to build a DB with specific radii.

 Any pointers welcome.

 rgds
 jp

 --
 This message is subject to the CSIR's copyright terms and conditions, e-mail
 legal notice, and implemented Open Document Format (ODF) standard. The full
 disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

 This message has been scanned for viruses and dangerous content by
 MailScanner, and is believed to be clean.  MailScanner thanks Transtec
 Computers for their support.

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] vpb build_master.source --radius-equator

2008-08-06 Thread J.P. Delport

Thanks Robert,

for now I've just hacked the BuildOptions code to always use my 
ellipsoid, but will use and test the general fix when you are done.


rgds
jp

Robert Osfield wrote:

Hi J.P,

Currently the radius settings are stored in the BuildOptions's
EllipsoidModel, it should staight forward to add the serialization of
its parameters. I'm working on VPB so I'll have a look at doing this
item.

Robert.

On Tue, Aug 5, 2008 at 3:54 PM, J.P. Delport [EMAIL PROTECTED] wrote:

Hi,

when setting the values --radius-equator and --radius-polar, the values in
the ellipsoidmodel are set in vpb, but they are not written to the
build_master.source file.

So, when doing a distributed build, these options get discarded when osgdem
reads the .source file.

I am still trying to get my head around how the parsing of the .source file
works.

Would a fix be as easy as adding the options to the BuildOptions and
BuildOptionsIO files?

I need to build a DB with specific radii.

Any pointers welcome.

rgds
jp


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenSceneGraph-2.6.0 release is available!

2008-08-06 Thread Jean-Sébastien Guay

Hello all,

Congrats to all, and thanks to everyone who helped with submissions, 
testing, suggestions, discussion and comments.


Great release!

J-S
--
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] About sort geometry

2008-08-06 Thread hesicong2006




Hi all,
I'm now working on a volume rendering project. What I need is to
improve performance. I had to split one volume bounding box into
numbers of boxes. The very important work to do is to sort the
geometry. Boxes must be rendered from nearest position to farest to get
right visual. 
So, does OSG has some functions to perform this task? Can the
setRenderingHint(osg::StateSet::TRANSPARENT_BIN) really help me?
Thanks!

Hesicong




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] About sort geometry

2008-08-06 Thread hesicong2006




Hi, Robert,
Is there a way to visually see the render order of geometry or the
console output of current rendering geometry? The draw callback runs
once and I can't use it to determine the render order. Can you give me
some advice?

Robert Osfield wrote:

  On Wed, Aug 6, 2008 at 3:09 PM, hesicong2006 [EMAIL PROTECTED] wrote:
  
  
Hi, robert,
I just noticed this line:

myvolumestateset-setRenderBinDetails(9,"FrontToBack");

Why you set details to 9 instead of other values?

  
  
It's just the bin number, 9 will draw before the standard transparent
bin that defaults to 10, 0 is the default opaque bin.  Choose what
ever value you want to control the high level ordering of bins.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

__ Information from ESET NOD32 Antivirus, version of virus signature database 3329 (20080805) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



  




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] About sort geometry

2008-08-06 Thread Thibault Genessay
Hi,

On Wed, Aug 6, 2008 at 4:48 PM, Robert Osfield [EMAIL PROTECTED] wrote:
 On Wed, Aug 6, 2008 at 3:40 PM, hesicong2006 [EMAIL PROTECTED] wrote:
 Hi, Robert,
 Is there a way to visually see the render order of geometry or the console
 output of current rendering geometry?

Give gDEBugger a try (there is a free trial of 30 days). You can break
during rendering and step through OpenGL calls just like you can step
in your program with a debugger. You will then be able to see the
primitives rendered one by one.

Regards

Thibault


 No.

  The draw callback runs once and I
 can't use it to determine the render order. Can you give me some advice?

 Not when I'm this busy.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] About sort geometry

2008-08-06 Thread hesicong2006




Thanks Thibault,
I use gDebugger and it should be a way to do so, but it's quite boring
to see the OpenGL commands. I must find a way to see the rendering
detail in order to debug my program. If there's really no simple way to
do this, it will be a pity.

Thibault Genessay wrote:

  Hi,

On Wed, Aug 6, 2008 at 4:48 PM, Robert Osfield [EMAIL PROTECTED] wrote:
  
  
On Wed, Aug 6, 2008 at 3:40 PM, hesicong2006 [EMAIL PROTECTED] wrote:


  Hi, Robert,
Is there a way to visually see the render order of geometry or the console
output of current rendering geometry?
  

  
  
Give gDEBugger a try (there is a free trial of 30 days). You can break
during rendering and step through OpenGL calls just like you can step
in your program with a debugger. You will then be able to see the
primitives rendered one by one.

Regards

Thibault

  
  
No.



   The draw callback runs once and I
can't use it to determine the render order. Can you give me some advice?
  

Not when I'm this busy.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


  
  ___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

__ Information from ESET NOD32 Antivirus, version of virus signature database 3329 (20080805) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



  




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light attenuation do nothing

2008-08-06 Thread Vincent Bourdier
Hi,
no answers...

So i've some questions to help me :

 * Does light direction and spotcuttoff incompatibles with attenuations ?
 * how to compute good attenuation values ?
 * why all the scene seems to be lighted by a directional spotlight,
including node behind spot, in the good direction ?
 * how to light a specified node, without (if possible) lightning the other
one ?

Thanks,

Regards,
Vincent.


2008/8/6 Vincent Bourdier [EMAIL PROTECTED]

 Hi Robert,

 Yes I know, i forgot to paste the code :

 osg::ref_ptrosg::Light light1 = new osg::Light;
 light1-setLightNum(1);

 Sorry

 Any idea ? because the red light is visible, but no attenuation modify
 it... and this is the real problem.
 Thanks,

 Vincent.

 2008/8/6 Robert Osfield [EMAIL PROTECTED]

 Hi Vincent,

 You'll need to set the light number of the light via
 light-setLightNum(num);  The first light should be 0, and your second
 one 1.

 Robert.

 On Wed, Aug 6, 2008 at 10:53 AM, Vincent Bourdier
 [EMAIL PROTECTED] wrote:
  Hi all,
 
  I've a scene with 2 lights :
 
  The first one (n°0) is the one for the whole scene, with ambiant
 component,
  diffuse, specular, ...
  The second one is attached on a node, and have to light only this node
 and
  not all the scene.
 
  To do that, I put some attenuation on the second light to avoid it light
 the
  reste of the scene... but it does nothing !
 
  light1-setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
  light1-setDiffuse(osg::Vec4(intensity, 0, 0, 1));
  light1-setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
  light1-setPosition(osg::Vec4(p1, 0));
  light1-setDirection(-p1);
  light1-setSpotCutoff(0.5f);
  light1-setConstantAttenuation(0.95f);
  light1-setLinearAttenuation(0.001f);
  light1-setQuadraticAttenuation(0.0002f);
 
  osg::LightSource* satLightSource1 = new osg::LightSource;
  satLightSource1-setLight(light1.get());
  satLightSource1-setLocalStateSetModes( osg::StateAttribute::ON );
  satLightSource1-getOrCreateStateSet()-setMode(GL_LIGHTING,
  osg::StateAttribute::ON);
 
  osg::LightModel* lightModel1 = new osg::LightModel;
  lightModel1-setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
  //0,0,0,1
  satLightSource1-getOrCreateStateSet()-setAttribute(lightModel1);
 
  group-addChild(satLightSource1);
 
  _root-getOrCreateStateSet()-setMode(GL_LIGHT1,
  osg::StateAttribute::ON);
 
  When I modify quadratic attenuation and linear attenuation, nothing
 appear
  to be changed in the scene, and a lot of nodes are lighted in red...
 
  Some idea why it doesn't works ?
  Thanks,
 
  Regards,
  Vincent.
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Polygon Mode = Wire and some Depth culling?

2008-08-06 Thread Sam

Hello,

the Cartoon renderer created cel shading, that was not exactly what I wanted 
since I cannot controll the color of the shaed of the model itself.


Now I am trying to get a grip onto oscscribe, I belive that using that 
technique and rendering the model as background color without shading may 
achieve the result I need.


Thanks :)

--
From: Robert Osfield [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2008 11:22 AM
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Polygon Mode = Wire and some Depth culling?


Hi Sam,

Hidden line removal is typically using a multi-pass technique, where
you render the subgraph twice, once with FILL PolygonMode, depth write
on, but colour write off, then a second time with LINE PolygonMode and
PolygonOffset to move it forward and depth write and colour turned
back on (although you could get awy with depth write off in this
pass).

The closest example of this would be the osgscribe example as it plays
with two passes and modifying the PolygonMode.

Robert.


On Wed, Aug 6, 2008 at 10:17 AM, Sam [EMAIL PROTECTED] wrote:

Hello,

I think hidden line removal could be it (was missing this term), but I am
actually short on time so I only can check that later.

An example of what I mean: If I see a wired cube I usually see the lines
that are at the cube's back. Quick google link -
http://www.cs.bham.ac.uk/~axs/fig/cube-only.png
What I want to render, is only the left, front and top side of the cube 
but

still remain in wired mode (like as the cube would be filled white). So I
think yes, this seems to be hidden line removal (correct me if I am 
wrong)


Thanks for the term so far :)
Sam

--
From: Robert Osfield [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2008 10:51 AM
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Polygon Mode = Wire and some Depth culling?


Hi Sam,

I can't work out form your email the exact effect you are after.  Is
that you want wireframe with hidden line removal?

Robert.

On Wed, Aug 6, 2008 at 9:27 AM, Sam [EMAIL PROTECTED] wrote:


Hello,

I am drawing a model as a wire-model. So I see only lines. Now I am
looking
for a way to cull all the lines in this case which would be otherwise
invisible because of the depth check. I am not talking about backface
culing.
The aim is here, to see only all edges of a model, that would be 
visible

if
the polygon mode would be not in wire mode and all edges that would be
filtered by depth check, even if they are frontfaces should not be 
drawn.

Is this possible? GL_DEPTH_TEST is enabled and I checked osg::Depth but
haven't found anything helpful yet.

Thanks
Sam



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light attenuation do nothing

2008-08-06 Thread Robert Osfield
On Wed, Aug 6, 2008 at 5:09 PM, Vincent Bourdier
[EMAIL PROTECTED] wrote:
 Hi,
 no answers...

 So i've some questions to help me :

  * Does light direction and spotcuttoff incompatibles with attenuations ?
  * how to compute good attenuation values ?
  * why all the scene seems to be lighted by a directional spotlight,
 including node behind spot, in the good direction ?
  * how to light a specified node, without (if possible) lightning the other
 one ?

OSG lighting is just standard OpenGL lighting, so pick up an book with
a chapter on OpenGL lighting you'll understand what the OSG does.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG 2.6: No OpenGL Context?

2008-08-06 Thread [EMAIL PROTECTED]
In upgrading my app today to OSG 2.6, I couldn't help but noticed that it 
crashed when I attempted to retrieve the OpenGL Vendor name.  It wasn't a great 
deal of work to determine that there was no valid OpenGL context when it was 
called.  A little further work showed that where I called  
this-_view-setThreadingModel(osgViewer::Viewer::SingleThreaded); seemed to 
cause the problem.  When I commented this out, i had a valid OpenGL Context, 
but OSG crashed later the first time it went to render the scene.  The app 
works fine with OSG 2.4, so I assume I must have just been doing something 
wrong this whole time and it's finally catching up with me!  I have tried to 
cut the class back as much as possible for an example (below).  The app creates 
an instance of this class, then calls graphicsInit(), then, finally, 
graphicsLoop().  I have a feeling the error lies in the constructor itself, but 
I don't know what I'm doing wrong.
(Just as a bit of background, this class is supposed to support Linux and 
Windows.  Under Windows, it supports rendering to its own OSG-created window or 
rendering to an OSG window inside a windows control.)  
Any ideas would be greatly appreciated!
Thanks!

OSGExample.cpp

#include iostream
#include osg/Group
#include osg/Geode
#include osg/Shader
#include osg/MatrixTransform
#include osg/Projection
#include osg/DisplaySettings
#include osg/Texture2D
#include osg/Drawable
#include osg/CopyOp
#include osg/TexGen
#include osg/Matrix
#include osg/FrontFace
#include osg/StateSet
#include osg/Notify
#include osgDB/ReadFile
#include osgDB/FileUtils
#include osgUtil/Optimizer
#include osgViewer/View
#include osgViewer/Viewer
#include osgViewer/CompositeViewer
#include osgViewer/ViewerEventHandlers
#ifdef WIN32
    #include osgViewer/api/Win32/GraphicsWindowWin32
#endif
using std::cerr;
class OSG
{
    public:    
    #ifdef WIN32
    OSG(unsigned int multisamples = 1, HWND hostWindowHWND 
= NULL);
    #else
    OSG(unsigned int multisamples = 1);
    #endif
    
    virtual ~OSG();
    virtual void graphicsInit();
    virtual void graphicsLoop();

    private:
    std::string _vendor;
    osgGA::MatrixManipulator* _viewerMatrix;
    osg::State* _state;
    osg::ref_ptrosg::Group _sceneGroup;
    osg::ref_ptrosg::GraphicsContext _graphicsContext;
    osg::ref_ptrosg::GraphicsContext::Traits _traits;
    osg::ref_ptrosg::DisplaySettings _displaySettings;
    osg::ref_ptrosg::GraphicsContext::WindowingSystemInterface 
_wsi;
    osgViewer::Viewer* _view;
    osgViewer::Viewer::Windows _viewWindows;
    // EventHandler* _eventHandler;
    osg::ref_ptrosg::Node _hiveNode;
    unsigned int _uniqueGraphicsStateID;
    unsigned int _multisamples;
    std::string _windowTitle;
    #ifdef WIN32
    HWND hostHWND;
    HWND _hwnd;
    HDC _hdc;
    HGLRC _wglContext;
    #endif
};

#ifdef WIN32
OSG::OSG(unsigned int multisamples, HWND hostWindowHWND)
#else
OSG::OSG(unsigned int multisamples)
#endif
{
    osg::setNotifyLevel(osg::ALWAYS);
    
    this-_view = NULL;
    this-_uniqueGraphicsStateID = 0;
    this-_multisamples = 0;
    // this-_eventHandler = NULL;
    this-_viewerMatrix = NULL;
    this-_state = NULL;
    this-_vendor = (null);
    #ifdef WIN32
    this-hostHWND = NULL;
    this-_hwnd = NULL;
    this-_hdc = NULL;
    this-_wglContext = NULL;
    #endif
    this-_multisamples = multisamples;
    // Create an event handler
    // this-_eventHandler = new EventHandler();
    // Setup the Windowing System Interface.
    this-_wsi = osg::GraphicsContext::getWindowingSystemInterface();
    // Setup the graphics context traits.
    {
    this-_traits = new osg::GraphicsContext::Traits;
    this-_traits-doubleBuffer = true;
    this-_traits-x = 0;
    this-_traits-y = 0;
    this-_traits-width = 256;
    this-_traits-height = 256;
    this-_traits-supportsResize = true;
    this-_traits-windowDecoration = true;
    this-_traits-windowName = myOSG;
    // Only used if we inherit from a more complex Windows Control
    #ifdef WIN32
    if(hostWindowHWND != NULL)
    {
    this-hostHWND = hostWindowHWND;
    // Get the current window size
    RECT rect;
  

[osg-users] problem with addEventHandler in the osgviewerWX example

2008-08-06 Thread Cysneros, Nelson SPAWAR
I have the osgviewerWX example running with OSG v2.2 and WxWidgets
v2.8.4 and everything seems to be working correctly.
 
But I did notice that the Stats display does not come up, although in
the example the StatsHandler was added to the viewer EventHandler.

viewer-addEventHandler(new
osgViewer::StatsHandler);
 
This makes sense because I would assume that all events are now being
handled by Wx EventHandlers.
 
 
My question: Is their a way to get the StatsHandler and other similar
Handlers to work when running with WxWidgets?
 
Thank you
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.6: No OpenGL Context?

2008-08-06 Thread Robert Osfield
Hi bbblurururughghghghghhbbb?  Sorry no signature on you email so this
guess was as good as any.

In OSG 2.6 the viewer.frame() by default releases the graphics context
rather than keeping it current, this change allows the viewer to be
interleaved with other viewers within a single frame loop.  You can
turn off this release of the graphics context via the
ViewerBase::setReleaseContextAtEndOfFrameHint method:

/** Hint to tell the renderingTraversals() method whether to
call relaseContext() on the last
  * context that was made current by the thread calling
renderingTraverals().  Note, when
  * running multi-threaded viewer no threads will be made
current or release current.
  * Setting this hint to false can enable the frame loop to be
lazy about calling makeCurrent
  * and releaseContext on each new frame, helping performance.
 However, if you frame loop
  * is managing multiple graphics context all from the main
frame thread then this hint must
  * be left on, otherwise the wrong context could be left
active, introducing errors in rendering.*/
void setReleaseContextAtEndOfFrameHint(bool hint) {
_releaseContextAtEndOfFrameHint = hint; }

However, I'd strongly recommend that you don't use this, and instead
just fix your application so you aren't doing OpenGL calls in the
frame loop as such usage is makes a really bad assumption that that
thread will have the graphics context current.   Why is so bad?

It's bad because the OSG allows you to run with various graphics
window setups and various threading models, almost all of which don't
ever a single graphis context that is current in the main thread,
amoung all this various ways of using the viewers one one case can
ever have the context current in the main thread and that's single
context, single threaded, but even slightly reconfigure the viewer and
BANG your applications breaks.

The right way to add OpenGL calls to the frame loop is the use a
Camera pre and post draw callback.  This applies to all the OSG 2.x
series.

Robert.




On Wed, Aug 6, 2008 at 7:00 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 In upgrading my app today to OSG 2.6, I couldn't help but noticed that it
 crashed when I attempted to retrieve the OpenGL Vendor name.  It wasn't a
 great deal of work to determine that there was no valid OpenGL context when
 it was called.  A little further work showed that where I called 
 this-_view-setThreadingModel(osgViewer::Viewer::SingleThreaded); seemed
 to cause the problem.  When I commented this out, i had a valid OpenGL
 Context, but OSG crashed later the first time it went to render the scene.
 The app works fine with OSG 2.4, so I assume I must have just been doing
 something wrong this whole time and it's finally catching up with me!  I
 have tried to cut the class back as much as possible for an example
 (below).  The app creates an instance of this class, then calls
 graphicsInit(), then, finally, graphicsLoop().  I have a feeling the error
 lies in the constructor itself, but I don't know what I'm doing wrong.

 (Just as a bit of background, this class is supposed to support Linux and
 Windows.  Under Windows, it supports rendering to its own OSG-created window
 or rendering to an OSG window inside a windows control.)

 Any ideas would be greatly appreciated!

 Thanks!

 
 OSGExample.cpp
 

 #include iostream

 #include osg/Group
 #include osg/Geode
 #include osg/Shader
 #include osg/MatrixTransform
 #include osg/Projection
 #include osg/DisplaySettings
 #include osg/Texture2D
 #include osg/Drawable
 #include osg/CopyOp
 #include osg/TexGen
 #include osg/Matrix
 #include osg/FrontFace
 #include osg/StateSet
 #include osg/Notify
 #include osgDB/ReadFile
 #include osgDB/FileUtils
 #include osgUtil/Optimizer
 #include osgViewer/View
 #include osgViewer/Viewer
 #include osgViewer/CompositeViewer
 #include osgViewer/ViewerEventHandlers

 #ifdef WIN32
 #include osgViewer/api/Win32/GraphicsWindowWin32
 #endif

 using std::cerr;

 class OSG
 {
 public:
 #ifdef WIN32
 OSG(unsigned int multisamples = 1, HWND
 hostWindowHWND = NULL);
 #else
 OSG(unsigned int multisamples = 1);
 #endif

 virtual ~OSG();
 virtual void graphicsInit();
 virtual void graphicsLoop();
 private:
 std::string _vendor;
 osgGA::MatrixManipulator* _viewerMatrix;
 osg::State* _state;
 osg::ref_ptrosg::Group _sceneGroup;
 osg::ref_ptrosg::GraphicsContext _graphicsContext;
 osg::ref_ptrosg::GraphicsContext::Traits _traits;
 osg::ref_ptrosg::DisplaySettings _displaySettings;
 osg::ref_ptrosg::GraphicsContext::WindowingSystemInterface
 _wsi;
 osgViewer::Viewer* _view;
 

Re: [osg-users] OSG 2.6: No OpenGL Context?

2008-08-06 Thread Adrian Egli OpenSceneGraph (3D)
Hi

i am not sure where the bug is coming from, but we had in the past (one
week) two threads on this topic. one was the problem of having a valid
OpenGL context for GL_Vendor,... request and the other was on Grapics
contex.

Is there a need to support such information in the osg core? if yes, we can
add a draw callback to retrieve the information at the end of the first
drawing pass, if this would be too late, because the application
needs such information at the really beginning may we have to retrieve this
information at the begining.

what is the community thining or the needs?

may you try to retrieve your vendor name in a draw callback. But your code
is not at all openscenegraph standard :-)

adrian


2008/8/6 [EMAIL PROTECTED] [EMAIL PROTECTED]

 In upgrading my app today to OSG 2.6, I couldn't help but noticed that it
 crashed when I attempted to retrieve the OpenGL Vendor name.  It wasn't a
 great deal of work to determine that there was no valid OpenGL context when
 it was called.  A little further work showed that where I called 
 this-_view-setThreadingModel(osgViewer::Viewer::SingleThreaded); seemed
 to cause the problem.  When I commented this out, i had a valid OpenGL
 Context, but OSG crashed later the first time it went to render the scene.
 The app works fine with OSG 2.4, so I assume I must have just been doing
 something wrong this whole time and it's finally catching up with me!  I
 have tried to cut the class back as much as possible for an example
 (below).  The app creates an instance of this class, then calls
 graphicsInit(), then, finally, graphicsLoop().  I have a feeling the error
 lies in the constructor itself, but I don't know what I'm doing wrong.

 (Just as a bit of background, this class is supposed to support Linux and
 Windows.  Under Windows, it supports rendering to its own OSG-created window
 or rendering to an OSG window inside a windows control.)

 Any ideas would be greatly appreciated!

 Thanks!

 
 OSGExample.cpp
 

 #include iostream

 #include osg/Group
 #include osg/Geode
 #include osg/Shader
 #include osg/MatrixTransform
 #include osg/Projection
 #include osg/DisplaySettings
 #include osg/Texture2D
 #include osg/Drawable
 #include osg/CopyOp
 #include osg/TexGen
 #include osg/Matrix
 #include osg/FrontFace
 #include osg/StateSet
 #include osg/Notify
 #include osgDB/ReadFile
 #include osgDB/FileUtils
 #include osgUtil/Optimizer
 #include osgViewer/View
 #include osgViewer/Viewer
 #include osgViewer/CompositeViewer
 #include osgViewer/ViewerEventHandlers

 #ifdef WIN32
 #include osgViewer/api/Win32/GraphicsWindowWin32
 #endif

 using std::cerr;

 class OSG
 {
 public:
 #ifdef WIN32
 OSG(unsigned int multisamples = 1, HWND
 hostWindowHWND = NULL);
 #else
 OSG(unsigned int multisamples = 1);
 #endif

 virtual ~OSG();
 virtual void graphicsInit();
 virtual void graphicsLoop();
 private:
 std::string _vendor;
 osgGA::MatrixManipulator* _viewerMatrix;
 osg::State* _state;
 osg::ref_ptrosg::Group _sceneGroup;
 osg::ref_ptrosg::GraphicsContext _graphicsContext;
 osg::ref_ptrosg::GraphicsContext::Traits _traits;
 osg::ref_ptrosg::DisplaySettings _displaySettings;

 osg::ref_ptrosg::GraphicsContext::WindowingSystemInterface _wsi;
 osgViewer::Viewer* _view;
 osgViewer::Viewer::Windows _viewWindows;
 // EventHandler* _eventHandler;
 osg::ref_ptrosg::Node _hiveNode;
 unsigned int _uniqueGraphicsStateID;
 unsigned int _multisamples;
 std::string _windowTitle;

 #ifdef WIN32
 HWND hostHWND;
 HWND _hwnd;
 HDC _hdc;
 HGLRC _wglContext;
 #endif
 };

 #ifdef WIN32
 OSG::OSG(unsigned int multisamples, HWND hostWindowHWND)
 #else
 OSG::OSG(unsigned int multisamples)
 #endif
 {
 osg::setNotifyLevel(osg::ALWAYS);

 this-_view = NULL;
 this-_uniqueGraphicsStateID = 0;
 this-_multisamples = 0;
 // this-_eventHandler = NULL;
 this-_viewerMatrix = NULL;
 this-_state = NULL;
 this-_vendor = (null);

 #ifdef WIN32
 this-hostHWND = NULL;
 this-_hwnd = NULL;
 this-_hdc = NULL;
 this-_wglContext = NULL;
 #endif

 this-_multisamples = multisamples;

 // Create an event handler
 // this-_eventHandler = new EventHandler();

 // Setup the Windowing System Interface.
 this-_wsi = osg::GraphicsContext::getWindowingSystemInterface();

 // Setup the graphics context 

Re: [osg-users] problem with addEventHandler in the osgviewerWX example

2008-08-06 Thread Robert Osfield
Please upgrade to 2.6, the osgviewerWX example now has stats working
just fine in the viewer.

On Wed, Aug 6, 2008 at 7:16 PM, Cysneros, Nelson SPAWAR
[EMAIL PROTECTED] wrote:
 I have the osgviewerWX example running with OSG v2.2 and WxWidgets v2.8.4
 and everything seems to be working correctly.

 But I did notice that the Stats display does not come up, although in the
 example the StatsHandler was added to the viewer EventHandler.
 viewer-addEventHandler(new osgViewer::StatsHandler);

 This makes sense because I would assume that all events are now being
 handled by Wx EventHandlers.


 My question: Is their a way to get the StatsHandler and other similar
 Handlers to work when running with WxWidgets?

 Thank you



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.6: No OpenGL Context?

2008-08-06 Thread Gordon Tomlinson
HI Adrian
 
I know for our apps we need to do some investigation of what OGL features we
have or don't have , and were doing this in the first draw, which is not
ideal as in many cases asking Opengl if it supports feature A is problematic
as drivers lie and say they say they support feature A but actually only
support it through a slow path or even s/w rendering ..
 
What we want to do at some point( when resources permit)  is to have a
generic lib/app that say creates a config file that lists all the OGL
features, and confirm them with a suite of stress tests to verify if they
are supported and give an indication of the machines ability to cope etc.
then consume config at start up adjust the feature we can use etc.. at some
point in the future

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian Egli
OpenSceneGraph (3D)
Sent: Wednesday, August 06, 2008 2:39 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] OSG 2.6: No OpenGL Context?


Hi 

i am not sure where the bug is coming from, but we had in the past (one
week) two threads on this topic. one was the problem of having a valid
OpenGL context for GL_Vendor,... request and the other was on Grapics
contex. 

Is there a need to support such information in the osg core? if yes, we can
add a draw callback to retrieve the information at the end of the first
drawing pass, if this would be too late, because the application 
needs such information at the really beginning may we have to retrieve this
information at the begining. 

what is the community thining or the needs?

may you try to retrieve your vendor name in a draw callback. But your code
is not at all openscenegraph standard :-) 

adrian 



2008/8/6 [EMAIL PROTECTED] [EMAIL PROTECTED]


In upgrading my app today to OSG 2.6, I couldn't help but noticed that it
crashed when I attempted to retrieve the OpenGL Vendor name.  It wasn't a
great deal of work to determine that there was no valid OpenGL context when
it was called.  A little further work showed that where I called 
this-_view-setThreadingModel(osgViewer::Viewer::SingleThreaded); seemed
to cause the problem.  When I commented this out, i had a valid OpenGL
Context, but OSG crashed later the first time it went to render the scene.
The app works fine with OSG 2.4, so I assume I must have just been doing
something wrong this whole time and it's finally catching up with me!  I
have tried to cut the class back as much as possible for an example (below).
The app creates an instance of this class, then calls graphicsInit(), then,
finally, graphicsLoop().  I have a feeling the error lies in the constructor
itself, but I don't know what I'm doing wrong.
 
(Just as a bit of background, this class is supposed to support Linux and
Windows.  Under Windows, it supports rendering to its own OSG-created window
or rendering to an OSG window inside a windows control.)  
 
Any ideas would be greatly appreciated!
 
Thanks!
 

OSGExample.cpp

 
#include iostream
 
#include osg/Group
#include osg/Geode
#include osg/Shader
#include osg/MatrixTransform
#include osg/Projection
#include osg/DisplaySettings
#include osg/Texture2D
#include osg/Drawable
#include osg/CopyOp
#include osg/TexGen
#include osg/Matrix
#include osg/FrontFace
#include osg/StateSet
#include osg/Notify
#include osgDB/ReadFile
#include osgDB/FileUtils
#include osgUtil/Optimizer
#include osgViewer/View
#include osgViewer/Viewer
#include osgViewer/CompositeViewer
#include osgViewer/ViewerEventHandlers
 
#ifdef WIN32
#include osgViewer/api/Win32/GraphicsWindowWin32
#endif
 
using std::cerr;
 
class OSG
{
public:
#ifdef WIN32
OSG(unsigned int multisamples = 1, HWND
hostWindowHWND = NULL);
#else
OSG(unsigned int multisamples = 1);
#endif

virtual ~OSG();
virtual void graphicsInit();
virtual void graphicsLoop();

private:
std::string _vendor;
osgGA::MatrixManipulator* _viewerMatrix;
osg::State* _state;
osg::ref_ptrosg::Group _sceneGroup;
osg::ref_ptrosg::GraphicsContext _graphicsContext;
osg::ref_ptrosg::GraphicsContext::Traits _traits;
osg::ref_ptrosg::DisplaySettings _displaySettings;
osg::ref_ptrosg::GraphicsContext::WindowingSystemInterface
_wsi;
osgViewer::Viewer* _view;
osgViewer::Viewer::Windows _viewWindows;
// EventHandler* _eventHandler;
osg::ref_ptrosg::Node _hiveNode;
unsigned int _uniqueGraphicsStateID;
unsigned int _multisamples;
std::string _windowTitle;
 
#ifdef WIN32
HWND hostHWND;
HWND _hwnd;
HDC _hdc;
  

[osg-users] IntersectionVisitor and Billboards.

2008-08-06 Thread Judd Tracy
I am trying to use the IntersectionVisitor to intersect with billboards 
and think I am having the same problem as what I am quoting here.  I was 
wondering if this was every resolved or not?  I really only need to 
perform LineSegmentIntersections, but I cannot figure out how to get 
this to work correctly.  If anyone knows of a solution I would be very 
appreciative of it.  Thanks


Judd


Hi Shuxing Xiao,

I just checked the code, and indeed the new IntersectionVisitor isn't
computing the matrix required to position and rotate the drawables
toward the intersector.  Clearly this bit of work hasn't been
completed.

This leaves the question of what the implementation should look like,
orientating a billboard towards a single line segment is straight
forward, but what about a polytope, or a plane or a group of
intersections?  I'm not sure about these later two.  The
IntersectionVisitor is by design decoupled from the actual
intersection types so doesn't directly know about the orientation.
This suggests we need to add some orientation method into the
Intersector base class.

I'm very busy with other tasks right now so can't tackle this, feel
free to have bash at implementing the orientation code.

Robert.

On 4/16/07, Shuxing Xiao [EMAIL PROTECTED] wrote:
  




I'm using osgUtil::LinesegmentIntersector to pick objects from my scene.

It works all fine except the Billboard nodes, all the objects can only be
picked at the origin point.

Since my drawables are added with a specified position, so I guess this
specified position didn't contribute to the view matrix.

I dig into the source code, and found that IntersectionVisitor treat
Billboard the same as Geode.

And I found that the old intersectvisitor considered the differences.

I wonder how to deal with this problem?

Thanks.
___
osg-users mailing list
[EMAIL PROTECTED]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.6: No OpenGL Context?

2008-08-06 Thread Robert Osfield
Hi Adrian,

A good way to add this type of initial setup testing is to use a
custom viewer realize operation. The osgshaderterrain example has a
such as custom realize operation - although reviewing the code know
the actual operation addition is currently commented out with an
associated comment suggesting that it crashed... commenting it back in
now doesn't reveal any problems so I think this crash has been fixed
by other improvements to the osgViewer w.r.t initialization.



Robert.

On Wed, Aug 6, 2008 at 7:38 PM, Adrian Egli OpenSceneGraph (3D)
[EMAIL PROTECTED] wrote:
 Hi

 i am not sure where the bug is coming from, but we had in the past (one
 week) two threads on this topic. one was the problem of having a valid
 OpenGL context for GL_Vendor,... request and the other was on Grapics
 contex.

 Is there a need to support such information in the osg core? if yes, we can
 add a draw callback to retrieve the information at the end of the first
 drawing pass, if this would be too late, because the application
 needs such information at the really beginning may we have to retrieve this
 information at the begining.

 what is the community thining or the needs?

 may you try to retrieve your vendor name in a draw callback. But your code
 is not at all openscenegraph standard :-)

 adrian


 2008/8/6 [EMAIL PROTECTED] [EMAIL PROTECTED]

 In upgrading my app today to OSG 2.6, I couldn't help but noticed that it
 crashed when I attempted to retrieve the OpenGL Vendor name.  It wasn't a
 great deal of work to determine that there was no valid OpenGL context when
 it was called.  A little further work showed that where I called 
 this-_view-setThreadingModel(osgViewer::Viewer::SingleThreaded); seemed
 to cause the problem.  When I commented this out, i had a valid OpenGL
 Context, but OSG crashed later the first time it went to render the scene.
 The app works fine with OSG 2.4, so I assume I must have just been doing
 something wrong this whole time and it's finally catching up with me!  I
 have tried to cut the class back as much as possible for an example
 (below).  The app creates an instance of this class, then calls
 graphicsInit(), then, finally, graphicsLoop().  I have a feeling the error
 lies in the constructor itself, but I don't know what I'm doing wrong.

 (Just as a bit of background, this class is supposed to support Linux and
 Windows.  Under Windows, it supports rendering to its own OSG-created window
 or rendering to an OSG window inside a windows control.)

 Any ideas would be greatly appreciated!

 Thanks!

 
 OSGExample.cpp
 

 #include iostream

 #include osg/Group
 #include osg/Geode
 #include osg/Shader
 #include osg/MatrixTransform
 #include osg/Projection
 #include osg/DisplaySettings
 #include osg/Texture2D
 #include osg/Drawable
 #include osg/CopyOp
 #include osg/TexGen
 #include osg/Matrix
 #include osg/FrontFace
 #include osg/StateSet
 #include osg/Notify
 #include osgDB/ReadFile
 #include osgDB/FileUtils
 #include osgUtil/Optimizer
 #include osgViewer/View
 #include osgViewer/Viewer
 #include osgViewer/CompositeViewer
 #include osgViewer/ViewerEventHandlers

 #ifdef WIN32
 #include osgViewer/api/Win32/GraphicsWindowWin32
 #endif

 using std::cerr;

 class OSG
 {
 public:
 #ifdef WIN32
 OSG(unsigned int multisamples = 1, HWND
 hostWindowHWND = NULL);
 #else
 OSG(unsigned int multisamples = 1);
 #endif

 virtual ~OSG();
 virtual void graphicsInit();
 virtual void graphicsLoop();
 private:
 std::string _vendor;
 osgGA::MatrixManipulator* _viewerMatrix;
 osg::State* _state;
 osg::ref_ptrosg::Group _sceneGroup;
 osg::ref_ptrosg::GraphicsContext _graphicsContext;
 osg::ref_ptrosg::GraphicsContext::Traits _traits;
 osg::ref_ptrosg::DisplaySettings _displaySettings;

 osg::ref_ptrosg::GraphicsContext::WindowingSystemInterface _wsi;
 osgViewer::Viewer* _view;
 osgViewer::Viewer::Windows _viewWindows;
 // EventHandler* _eventHandler;
 osg::ref_ptrosg::Node _hiveNode;
 unsigned int _uniqueGraphicsStateID;
 unsigned int _multisamples;
 std::string _windowTitle;

 #ifdef WIN32
 HWND hostHWND;
 HWND _hwnd;
 HDC _hdc;
 HGLRC _wglContext;
 #endif
 };
 #ifdef WIN32
 OSG::OSG(unsigned int multisamples, HWND hostWindowHWND)
 #else
 OSG::OSG(unsigned int multisamples)
 #endif
 {
 osg::setNotifyLevel(osg::ALWAYS);

 this-_view = NULL;
 this-_uniqueGraphicsStateID = 0;
 this-_multisamples = 0;
 // this-_eventHandler = 

[osg-users] Mac / X-Code build problem

2008-08-06 Thread James Turner
I'm encountering a bizarre problem with my X-Code build - with (so  
far) 2.5.5 and the 2.6.0-rc2 (will try 2.6.0-final in a moment). I'll  
say right now that I assume it must be a local config problem, I'm not  
trying to blame OSG for the problem (much), just need some help to get  
things working.


Using the supplied X-Code projects, I can build all of OSG just fine.  
It so happens that I'm switching the SDK from 10.4 to 10.5, and I have  
to fix one path in project to build : the osgWidgets path references  
itself via a path that only works in checkout, not a snapshot. Both of  
these things seem pretty minor and unrelated to the problem I'm having.


The problem is, having built **all** of OSG (in either debug or  
release, BTW), nothing works - all the OSG apps launch, but segfault  
within a few seconds - some immediately, some others sort of work  
(osgplanets, untextured) but then crash, others load but the display  
is broken (osgforrest, the tree billboard quads are random colors,  
then it crashes) and so on. The crashes are all very strange - deep  
inside the AGL / CGL code, pthread mutex or condvar internal segfaults  
(loads of these), or just in the guts of the GL driver. Most seem to  
be mangled pointers, but when I look at the OSG objects on the stack,  
they usually look okay - no obvious corruption, though I'm guessing  
what values are sane for the OSG internals.


So, something is obviously very screwed up with my build (or my  
runtime environment). I've built and run countless other GL  
applications with the same tool chain, and I build C++ apps every day  
- I am sceptical that something is seriously wrong with my compiler /  
OpenGL framework / GL driver. Oh, yes, this happens on two different  
machines (both running 10.5 and X-Code 3.0 / 3.1), a MacPro and a  
MacBook Pro.


S - what on earth can be going on? I'm looking forward to testing  
a binary 2.6.0 release, but I'm also mystified. The whole thing feels  
like memory corruption or some hellish threading problem, but I don't  
see why I would be getting those when no one else is.


So, any bright ideas? I'd be happy to have my amazingly dumb mistake  
pointed out.


I suppose I should try a Cmake build of 2.6.0 as well.

James
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac / X-Code build problem

2008-08-06 Thread Eric Sokolowsky

James Turner wrote:
I'm encountering a bizarre problem with my X-Code build - with (so 
far) 2.5.5 and the 2.6.0-rc2 (will try 2.6.0-final in a moment). I'll 
say right now that I assume it must be a local config problem, I'm not 
trying to blame OSG for the problem (much), just need some help to get 
things working.


Using the supplied X-Code projects, I can build all of OSG just fine. 
It so happens that I'm switching the SDK from 10.4 to 10.5, and I have 
to fix one path in project to build : the osgWidgets path references 
itself via a path that only works in checkout, not a snapshot. Both of 
these things seem pretty minor and unrelated to the problem I'm having.


The problem is, having built **all** of OSG (in either debug or 
release, BTW), nothing works - all the OSG apps launch, but segfault 
within a few seconds - some immediately, some others sort of work 
(osgplanets, untextured) but then crash, others load but the display 
is broken (osgforrest, the tree billboard quads are random colors, 
then it crashes) and so on. The crashes are all very strange - deep 
inside the AGL / CGL code, pthread mutex or condvar internal segfaults 
(loads of these), or just in the guts of the GL driver. Most seem to 
be mangled pointers, but when I look at the OSG objects on the stack, 
they usually look okay - no obvious corruption, though I'm guessing 
what values are sane for the OSG internals.


So, something is obviously very screwed up with my build (or my 
runtime environment). I've built and run countless other GL 
applications with the same tool chain, and I build C++ apps every day 
- I am sceptical that something is seriously wrong with my compiler / 
OpenGL framework / GL driver. Oh, yes, this happens on two different 
machines (both running 10.5 and X-Code 3.0 / 3.1), a MacPro and a 
MacBook Pro.


S - what on earth can be going on? I'm looking forward to testing 
a binary 2.6.0 release, but I'm also mystified. The whole thing feels 
like memory corruption or some hellish threading problem, but I don't 
see why I would be getting those when no one else is.


So, any bright ideas? I'd be happy to have my amazingly dumb mistake 
pointed out.


I suppose I should try a Cmake build of 2.6.0 as well.

James,

I can't speak about the Xcode project that comes with OSG, but I believe 
it is no longer actively maintained. While Xcode support is still far 
from perfect within CMake, I have made many recent improvements to the 
CMake build system Xcode generator. Give it a try. CMake 2.6 is 
required, and there is a nice GUI version on the CMake downloads page.


There are several caveats to building OSG on OSX that you should be 
aware of. Read the README.txt file in the base directory of the OSG 2.6 
source code. Feedback is welcome.


-Eric
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac / X-Code build problem

2008-08-06 Thread James Turner


On 6 Aug 2008, at 21:57, Eric Sokolowsky wrote:

I can't speak about the Xcode project that comes with OSG, but I  
believe it is no longer actively maintained. While Xcode support is  
still far from perfect within CMake, I have made many recent  
improvements to the CMake build system Xcode generator. Give it a  
try. CMake 2.6 is required, and there is a nice GUI version on the  
CMake downloads page.


It's quite unusual (in an open source project) to discover that  
something isn't actively maintained when it apparently works fine :)  
Of course, it's not 'working fine', but equally, the projects are for  
X-Code 3.0, and give every appearance of building all the code and  
generally functioning. Anyway, thanks for pointing this out. I will go  
and try a CMake build now.


There are several caveats to building OSG on OSX that you should be  
aware of. Read the README.txt file in the base directory of the OSG  
2.6 source code. Feedback is welcome.


I've read the README, it seems pretty clear and as far as I know I'm  
complying with its instructions - but I will double-check.


Thanks,
James

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgdem and UTM terrain tiles...

2008-08-06 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Using the GDAL tools, I've built a mosaic of terrain tiles that I'm
stitching together using osgdem to create a terrain database. Each terrain
tile uses a UTM mapping that is reprojected from a lat/long mapping.
Unfortunately when I do the reprojection for each tile, the terrain tile
gets slightly shifted so that when I stitch them all together using osgdem,
I have discontinuities at each tile boundary in the finished terrain
database.

 

My question is, is there a way to avoid this nasty artifact using either
GDAL or osgdem? Perhaps I need to resort to another tool to massage the data
before handing it over to osgdem?

 

Thanks for any input in advance.

-Shayne



smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osg and speedtree

2008-08-06 Thread Jon Newell

Hi  everyone,

I know this question has been asked previously but I have not  been able 
to locate a definitive answer so..
We have a need to implement speedtree into OSG,  and am wondering if 
anyone has had prior success with this?
From a cursory glance it does not appear that it will be as straight 
forward as the SPT documentation would have us believe.


If so does anyone have any pointers, tips or perhaps even  reference 
code they may be willing to share that may be of assistance???


I would be grateful for any help!

cheers

Jon Newell





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] 回复:

2008-08-06 Thread monkey
hi,
 Only set osg::Texture::REPEAT is not enough!
  
  
 -- 原始邮件 --
  发件人: Paul Melis[EMAIL PROTECTED];
 发送时间: 2008年7月30日(星期三) 下午04:57
 收件人: OpenSceneGraph Usersosg-users@lists.openscenegraph.org; 
 
 主题: Re: [osg-users] 

  
 monkey wrote:
 Thank for you all!
 osgExp is *REALLY NOT* surport Texture UV repeat!
 But I have make it run ok through change its code!
 Thank you very much!
Looking into the current osgExp sources it seems that it already should 
have support for repeating textures. Whenever a texture coordinate is 
encountered that is outside the [0,1] range, the wrap setting for the 
exported Texture2D is set to osg::Texture::REPEAT.

You said in an earlier mail that the UV coordinates in the exported file 
are incorrect (0..1 instead of 0..3), but do you see the REPEAT in the 
output file?

Paul
 --  原始邮件 --
 *发件人:* GMD GammerMaxyandex.ru[EMAIL PROTECTED];
 *发送时间:* 2008年7月29日(星期二) 凌晨02:59
 *收件人:* osg-usersosg-users@lists.openscenegraph.org;
 *主题:* Re: [osg-users] help me!
  osgExp is not surport Texture UV repeat?
 Yes :(


 28.07.08, 14:43, Alberto Luaces [EMAIL PROTECTED]:

  Hi,
  Sorry, I have no expertise with 3DSMax and/or osgExp, so I cannot 
 help you
  further. Nevertheless, here is the osgExp code download page address:
  http://sourceforge.net/svn/?group_id=148454
  I suppose there are compilation instructions within the source.
  El Viernes 25 Julio 2008ES 07:00:08 monkeymonkey escribió:
   hi!Thank you for your answer!
   I try it as you say,
   but not right also,i think because Texture Coord output of osgExp 
 is not
   right,they are between 0 and 1,it should be 0 to 3. i change it , 
 it is
   OK!, so it is the really reason.
   I must change osgExp scource code,and recompile it? how to do it?
  
From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org 
 Date: Wed,
23 Jul 2008 09:57:33 +0200 Subject: Re: [osg-users] help me!  
 Hi, 
El Miércoles 23 Julio 2008ES 08:48:19 monkeymonkey escribió:  
 hi!  
 i use Texture UV repeat 3.0 in 3dsMax8,but when i output it to 
 ive,then
use  osgViewer to look,texture is not right.   it seem that 
 repeat is
not work! why?osgExp is not surport Texture UV repeat? 
 how to
make it?  Convert your .ive to .osg with osgconv, then look 
 for the
wrap parameter in  the file like  wrap_s,t,... REPEAT  If 
 there is
something other word than REPEAT, change it.  Alberto
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
  
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 -- 
 Много спама? Пользуйтесь Яндекс.Почтой http://mail.yandex.ru/nospam
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org