Re: [osg-users] Transparent node cast shadow with ShadowMap?

2010-01-13 Thread Dominic Stalder
Hi J-S

thanks for the reply. I solved it a little bit tricky: now we have 2 nodes of 
the same object, one is connected to the shadowed scene, casts shadows but is 
completly culled away, the other is connected to the scene root node but 
doesn't cast shadows.

Thats all ;-)

Regards
Dominic

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22571#22571





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


[osg-users] Transparent node cast shadow with ShadowMap?

2010-01-12 Thread Dominic Stalder

Hi there

I would like to have my object cast a shadow to its environment with 
ShadowMap and ShadowedScene. This works, but - like ShadowMap defines - 
there are shadows on the object self. It is not possible to turn off 
these shadows, is it?


Now I disabled the cast mask for the original object and tried to have 
an equal object at the same position with the cast mask enabled, but 
this object is transparent. Now the shadowing doesn't work anymore. I 
then set the alpha factor of the "shadow" object to 0.01, but it sill 
shows shadows on the original object. Is there another way to resolve 
this problem?


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


Re: [osg-users] Rendering a depth texture quickly

2010-01-11 Thread Dominic Stalder

knarf wrote:
> 
> I've implemented a feature that is similar to shadow mapping in that I first 
> have to render the scene from another point of view, and this rendering is 
> depth-only. I'm not using it for shadows, but this first depth-only pass is 
> conceptually the same.
> 
> 


Hi Frank

I actually can't render the depth buffer to a texture nor to an image. Would it 
be possible to post sour RTT code?

Thanks a lot and regards
Dominic

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22418#22418





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


Re: [osg-users] Depth buffer for shadow mapping

2010-01-11 Thread Dominic Stalder
Its still not working with tiff. But I also have problems when I put it 
directly into the texture, it doesn't work too.


Any ideas?

Am 11.01.10 22:27, schrieb Mourad Boufarguine:

Hi Dominic,

AFAIK, the png plugin does not support writing depth image. Try the 
tiff plugin in svn/trunk ; a recent submission made it write depth 
images, and it works for me.


Mourad

On Mon, Jan 11, 2010 at 4:17 PM, Dominic Stalder 
mailto:dominic.stal...@bluewin.ch>> wrote:


Hi there

I have the following RTT method:

   ref_ptr image = new Image;
   image->allocateImage(osgViewer->width(), osgViewer->height(),
1, GL_RGBA, GL_UNSIGNED_BYTE);

   // resets the size of the texture
   texture->setTextureSize(osgViewer->width(), osgViewer->height());

   // sets the clear mask the depth buffer
   camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   // sets the clear color to white
   camera->setClearColor(Vec4(1.0, 1.0, 1.0, 1.0));

   ...matrices and viewport...

   // sets the reference frame to an absolute coordinate frame
   camera->setReferenceFrame(Camera::ABSOLUTE_RF_INHERIT_VIEWPOINT);

   // sets the texture camera to render before rendering to the screen
   camera->setRenderOrder(Camera::PRE_RENDER);

   // sets the rendering target of the texture camera to the frame
buffer object (FBO)
   camera->setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);

   // attaches the texture to the texture camera (important:
samples mustn't be greater than zero)
   // buffer component, texture, level, face, mip map generation,
samples, color samples
   camera->attach(Camera::COLOR_BUFFER, image.get(), 0, 0);

   // adds the node to the texture camera (this node will be
rendered to the texture)
   camera->addChild(node);

   // adds the texture camera to the root node
   root->addChild(camera);

If I write this image to file, it works great, I have my "balance"
in the middle of the image --> see attachment color_buffer.png.
Now I would like to write the depth buffer to the image (just for
debugging, afterward I write it to the texture), so I change the
following lines:

image->allocateImage(osgViewer->width(), osgViewer->height(), 1,
GL_RGBA, GL_UNSIGNED_BYTE); -->
image->allocateImage(osgViewer->width(), osgViewer->height(), 1,
GL_DEPTH_COMPONENT, GL_FLOAT);

camera->attach(Camera::COLOR_BUFFER, image.get(), 0, 0); -->
camera->attach(Camera::DEPTH_BUFFER, image.get(), 0, 0);

After that I get the image depth_buffer.png, but this isn't
correct, is it?

The texture looks like this, is it correct?

   // creates the texture for the shadow map
   texShadowMap = new Texture2D;
   texShadowMap->setInternalFormat(GL_DEPTH_COMPONENT);
   texShadowMap->setShadowComparison(true);
   texShadowMap->setShadowTextureMode(Texture2D::LUMINANCE);
   texShadowMap->setFilter(Texture2D::MIN_FILTER, Texture2D::LINEAR);
   texShadowMap->setFilter(Texture2D::MAG_FILTER, Texture2D::LINEAR);
   texShadowMap->setWrap(Texture2D::WRAP_S,
Texture2D::CLAMP_TO_BORDER);
   texShadowMap->setWrap(Texture2D::WRAP_T,
Texture2D::CLAMP_TO_BORDER);
   texShadowMap->setBorderColor(Vec4(1.0, 1.0, 1.0, 1.0));

What am I doing wrong in this function?

Thanks a lot
Dominic

___
osg-users mailing list
osg-users@lists.openscenegraph.org
<mailto: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] Depth buffer for shadow mapping

2010-01-11 Thread Dominic Stalder

Hi Simon

I'm attaching to the depth buffer (look on the right --> 
camera->attach(Camera::DEPTH_BUFFER, image.get(), 0, 0); ;-)


Thanks anyway.

Dominic


Am 11.01.10 22:15, schrieb Simon Hammett:
2010/1/11 Dominic Stalder <mailto:dominic.stal...@bluewin.ch>>


camera->attach(Camera::COLOR_BUFFER, image.get(), 0, 0); -->
camera->attach(Camera::DEPTH_BUFFER, image.get(), 0, 0);


Well you are trying to attach a depth texture to the color buffer, 
that's not going to work.


Try

camera->attach(Camera::DEPTH_BUFFER, ...

instead.

--
http://www.ssTk.co.uk


___
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] Depth buffer for shadow mapping

2010-01-11 Thread Dominic Stalder

Hi there

I have the following RTT method:

ref_ptr image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE);


// resets the size of the texture
texture->setTextureSize(osgViewer->width(), osgViewer->height());

// sets the clear mask the depth buffer
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// sets the clear color to white
camera->setClearColor(Vec4(1.0, 1.0, 1.0, 1.0));

...matrices and viewport...

// sets the reference frame to an absolute coordinate frame
camera->setReferenceFrame(Camera::ABSOLUTE_RF_INHERIT_VIEWPOINT);

// sets the texture camera to render before rendering to the screen
camera->setRenderOrder(Camera::PRE_RENDER);

// sets the rendering target of the texture camera to the frame 
buffer object (FBO)

camera->setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);

// attaches the texture to the texture camera (important: samples 
mustn't be greater than zero)
// buffer component, texture, level, face, mip map generation, 
samples, color samples

camera->attach(Camera::COLOR_BUFFER, image.get(), 0, 0);

// adds the node to the texture camera (this node will be rendered 
to the texture)

camera->addChild(node);

// adds the texture camera to the root node
root->addChild(camera);

If I write this image to file, it works great, I have my "balance" in 
the middle of the image --> see attachment color_buffer.png. Now I would 
like to write the depth buffer to the image (just for debugging, 
afterward I write it to the texture), so I change the following lines:


image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE); --> image->allocateImage(osgViewer->width(), 
osgViewer->height(), 1, GL_DEPTH_COMPONENT, GL_FLOAT);


camera->attach(Camera::COLOR_BUFFER, image.get(), 0, 0); --> 
camera->attach(Camera::DEPTH_BUFFER, image.get(), 0, 0);


After that I get the image depth_buffer.png, but this isn't correct, is it?

The texture looks like this, is it correct?

// creates the texture for the shadow map
texShadowMap = new Texture2D;
texShadowMap->setInternalFormat(GL_DEPTH_COMPONENT);
texShadowMap->setShadowComparison(true);
texShadowMap->setShadowTextureMode(Texture2D::LUMINANCE);
texShadowMap->setFilter(Texture2D::MIN_FILTER, Texture2D::LINEAR);
texShadowMap->setFilter(Texture2D::MAG_FILTER, Texture2D::LINEAR);
texShadowMap->setWrap(Texture2D::WRAP_S, Texture2D::CLAMP_TO_BORDER);
texShadowMap->setWrap(Texture2D::WRAP_T, Texture2D::CLAMP_TO_BORDER);
texShadowMap->setBorderColor(Vec4(1.0, 1.0, 1.0, 1.0));

What am I doing wrong in this function?

Thanks a lot
Dominic
<><>___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DrawCallback only once

2010-01-11 Thread Dominic Stalder

Hi Robert

thanks a lot, at the moment it works fine the way I made it. But I will 
try this solution as soon as possible.


Am 11.01.10 11:41, schrieb Robert Osfield:

The best way to do a single GL test at startup is to attach a custom
osg::GraphicsOperation as a RealizeOperation to the viewer, and this
gets called once the viewer's graphics contexts get realized.

Have a look at the osgcatch, osgshaderterrrain and osgvolume examples
to see examples of the above in action.
   


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


Re: [osg-users] DrawCallback only once

2010-01-09 Thread Dominic Stalder

Hi Dj and Tim

thanks for the answers, I made a little hack, but it works for me ;-) In 
the operator() method I just set the pre draw callback of the camera to 
zero, so the method never gets called again later.


void GameViewOSG::GameViewOSGDrawCallback::operator()(const Camera&) const
{
parent->osgCamera->setPreDrawCallback(NULL);
}

Regards
Dominic

Am 09.01.10 00:55, schrieb Tim Moore:



On Fri, Jan 8, 2010 at 9:50 PM, Dominic Stalder 
mailto:dominic.stal...@bluewin.ch>> wrote:


Hi there

I would like to read the OpenGL extensions with
isGLExtensionSupported(), but for this I need a draw context. I
registred a DrawCallback Class, see below. I need to call the
operator() method only once, but because this method is const, I
cannot write to the member variable bool first. How can I resolve
this problem?

   class GameViewOSGDrawCallback : public
osg::Camera::DrawCallback
   {
   private:
   GameViewOSG *parent;
   bool first;

   public:
   GameViewOSGDrawCallback(GameViewOSG* parent=0);

   virtual void operator()(const osg::Camera&) const;
   };

You might look at using an Operation on the graphics context, which 
has a "one-shot" mode that is more convenient and efficient than a 
boolean in a callback. Take a look at the Operation class in 
osg/OperationThread and osg::GraphicsContext::add(Operation*).


Tim


___
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] DrawCallback only once

2010-01-08 Thread Dominic Stalder

Hi there

I would like to read the OpenGL extensions with 
isGLExtensionSupported(), but for this I need a draw context. I 
registred a DrawCallback Class, see below. I need to call the operator() 
method only once, but because this method is const, I cannot write to 
the member variable bool first. How can I resolve this problem?


class GameViewOSGDrawCallback : public osg::Camera::DrawCallback
{
private:
GameViewOSG *parent;
bool first;

public:
GameViewOSGDrawCallback(GameViewOSG* parent=0);

virtual void operator()(const osg::Camera&) const;
};

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


Re: [osg-users] Check for GLSL hardware support

2010-01-08 Thread Dominic Stalder

But how is this done in OSG, if I don't want to use native OpenGL?

Thanks

Am 07.01.10 18:37, schrieb Martin Beckett:

Not as a standard OpengL feature (AFAIK) the whole point is that the driver 
takes care of it and you don't have to care (I know you do really !)

You can check the versions of GLSL supported but not how the card is doing it - 
see http://www.gamedev.net/community/forums/topic.asp?topic_id=552800


Martin

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22253#22253





___
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] Check for GLSL hardware support

2010-01-07 Thread Dominic Stalder

Hi there

is it possible to check if the given hardware is able to render the 
shader in hardware instead of a software shader?


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


Re: [osg-users] Write to texture file for lightning

2010-01-06 Thread Dominic Stalder

Hi jp

thanks, but I'm using the texture directly in my shader so I don't use a 
geometry. Don't ask me how I resolved all the problem, but now it works 
(crossing my fingers) ;-) For the rotation I used a Matrix and a 
MatrixTransform, added the node (which gets rendered to texture) and 
added this MatrixTransform to the texture camera.


Thanks all you guys for the patient help!

Dominic

Am 06.01.10 10:57, schrieb J.P. Delport:

Hi,

just flip to texture coordinates of the quad you are drawing in the RTT
camera.

jp

Dominic Stalder wrote:

Hi

if I attach the texture instead of the image it is working. But when I
call the methode renderToTexture right after 
osgViewer->setSceneData() I get the following error:


GraphicsWindowCarbon::grabFocusIfPointerInWindow

When I wait about 200 ms with an QTimer, it works but then I have the 
problem that the scene is not yet ready when it gets painted to the 
screen - ugly artefacts.


Another problem: how can I scale / mirror the texture directly? I 
know TexMat's but they need to be applied to an osg:Node and can not 
be applied to a osg:Texture2D?


Thanks a lot

Am 05.01.10 13:45, schrieb Dominic Stalder:

Hi

I solved the problem, the projection matrix was the problem. Now if 
I call the following method, ONE image is made successful, if I call 
it a second time, the image gets all black again. Do I have to clear 
or reset something in between?


void GameViewOSG::renderToTexture(ref_ptr node, 
ref_ptr texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptr image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE); // TODO: maybe GL_UNSIGNED_BYTE


// sets the viewport of the texture camera
texCamera->setViewport(0, 0, osgViewer->width(), 
osgViewer->height());


// attaches the texture to the texture camera
// buffer component, texture, level, face, mip map generation, 
samples, color samples

//texCamera->attach(buffer, texture.get(), 0, 0, false, 4, 0);
texCamera->attach(buffer, image, 4, 0); // just for testing

// adds the node to the texture camera (this node will be 
rendered to the texture)

texCamera->addChild(node);

if (!root->containsNode(texCamera))
// adds the texture camera to the root node
root->addChild(texCamera);

osgViewer->frame();

// just for testing
osgDB::writeImageFile(*image, "/Users/dst/Downloads/test.bmp");
}

Dominic

Am 05.01.10 07:23, schrieb J.P. Delport:

Hi,

have you tried writing the image in the camera callback? Maybe have 
a look at osgprerender and osgscreencapture.


jp

Dominic Stalder wrote:

Sorry for hesitating, but the time of our project is running ;-)

Someone any idea what I did wrong with the texture / image camera? 
Or is there a problem with the addChild hirarchy?


Thanks a lot

Am 03.01.10 12:05, schrieb Dominic Stalder:

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl 
clear color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), 
osgViewer->height(), 1,

GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image 
and sets the

rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and 
writes it to

disk. But the image is all black.
Did you omit some code between 'root->addChild()' and 
'writeImageFile'?  There should be a
call to render the frame (like 'osgViewer->frame()') otherwise 
the Image will remain black.


Does anybody see an error or what could be the problem? I also 
tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work 
too. Is

there a problem with the hirachy:
GL_U_B is fine, this will probably also give you better 
performance.


Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-05 Thread Dominic Stalder
I'm sorry for posting that much, but I can't do it right the FBO 
rendering to texture.


If I take some other osg:Node's it brings the following warning:

Warning: detected OpenGL error 'invalid framebuffer operation' after 
RenderBin::draw(,)


If someone knows how to do it rigth, just mail ;-)

Am 05.01.10 13:45, schrieb Dominic Stalder:

Hi

I solved the problem, the projection matrix was the problem. Now if I 
call the following method, ONE image is made successful, if I call it 
a second time, the image gets all black again. Do I have to clear or 
reset something in between?


void GameViewOSG::renderToTexture(ref_ptr node, 
ref_ptr texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptr image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE); // TODO: maybe GL_UNSIGNED_BYTE


// sets the viewport of the texture camera
texCamera->setViewport(0, 0, osgViewer->width(), 
osgViewer->height());


// attaches the texture to the texture camera
// buffer component, texture, level, face, mip map generation, 
samples, color samples

//texCamera->attach(buffer, texture.get(), 0, 0, false, 4, 0);
texCamera->attach(buffer, image, 4, 0); // just for testing

// adds the node to the texture camera (this node will be rendered 
to the texture)

texCamera->addChild(node);

if (!root->containsNode(texCamera))
// adds the texture camera to the root node
root->addChild(texCamera);

osgViewer->frame();

// just for testing
osgDB::writeImageFile(*image, "/Users/dst/Downloads/test.bmp");
}

Dominic

Am 05.01.10 07:23, schrieb J.P. Delport:

Hi,

have you tried writing the image in the camera callback? Maybe have a 
look at osgprerender and osgscreencapture.


jp

Dominic Stalder wrote:

Sorry for hesitating, but the time of our project is running ;-)

Someone any idea what I did wrong with the texture / image camera? 
Or is there a problem with the addChild hirarchy?


Thanks a lot

Am 03.01.10 12:05, schrieb Dominic Stalder:

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl clear 
color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), 
osgViewer->height(), 1,

GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image and 
sets the

rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and 
writes it to

disk. But the image is all black.
Did you omit some code between 'root->addChild()' and 
'writeImageFile'?  There should be a
call to render the frame (like 'osgViewer->frame()') otherwise the 
Image will remain black.



Does anybody see an error or what could be the problem? I also tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is
there a problem with the hirachy:

GL_U_B is fine, this will probably also give you better performance.

Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-05 Thread Dominic Stalder

Hi

if I attach the texture instead of the image it is working. But when I 
call the methode renderToTexture right after osgViewer->setSceneData() I 
get the following error:


GraphicsWindowCarbon::grabFocusIfPointerInWindow

When I wait about 200 ms with an QTimer, it works but then I have the 
problem that the scene is not yet ready when it gets painted to the 
screen - ugly artefacts.


Another problem: how can I scale / mirror the texture directly? I know 
TexMat's but they need to be applied to an osg:Node and can not be 
applied to a osg:Texture2D?


Thanks a lot

Am 05.01.10 13:45, schrieb Dominic Stalder:

Hi

I solved the problem, the projection matrix was the problem. Now if I 
call the following method, ONE image is made successful, if I call it 
a second time, the image gets all black again. Do I have to clear or 
reset something in between?


void GameViewOSG::renderToTexture(ref_ptr node, 
ref_ptr texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptr image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE); // TODO: maybe GL_UNSIGNED_BYTE


// sets the viewport of the texture camera
texCamera->setViewport(0, 0, osgViewer->width(), 
osgViewer->height());


// attaches the texture to the texture camera
// buffer component, texture, level, face, mip map generation, 
samples, color samples

//texCamera->attach(buffer, texture.get(), 0, 0, false, 4, 0);
texCamera->attach(buffer, image, 4, 0); // just for testing

// adds the node to the texture camera (this node will be rendered 
to the texture)

texCamera->addChild(node);

if (!root->containsNode(texCamera))
// adds the texture camera to the root node
root->addChild(texCamera);

osgViewer->frame();

// just for testing
osgDB::writeImageFile(*image, "/Users/dst/Downloads/test.bmp");
}

Dominic

Am 05.01.10 07:23, schrieb J.P. Delport:

Hi,

have you tried writing the image in the camera callback? Maybe have a 
look at osgprerender and osgscreencapture.


jp

Dominic Stalder wrote:

Sorry for hesitating, but the time of our project is running ;-)

Someone any idea what I did wrong with the texture / image camera? 
Or is there a problem with the addChild hirarchy?


Thanks a lot

Am 03.01.10 12:05, schrieb Dominic Stalder:

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl clear 
color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), 
osgViewer->height(), 1,

GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image and 
sets the

rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and 
writes it to

disk. But the image is all black.
Did you omit some code between 'root->addChild()' and 
'writeImageFile'?  There should be a
call to render the frame (like 'osgViewer->frame()') otherwise the 
Image will remain black.



Does anybody see an error or what could be the problem? I also tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is
there a problem with the hirachy:

GL_U_B is fine, this will probably also give you better performance.

Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-05 Thread Dominic Stalder

Hi

I solved the problem, the projection matrix was the problem. Now if I 
call the following method, ONE image is made successful, if I call it a 
second time, the image gets all black again. Do I have to clear or reset 
something in between?


void GameViewOSG::renderToTexture(ref_ptr node, ref_ptr 
texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptr image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE); // TODO: maybe GL_UNSIGNED_BYTE


// sets the viewport of the texture camera
texCamera->setViewport(0, 0, osgViewer->width(), osgViewer->height());

// attaches the texture to the texture camera
// buffer component, texture, level, face, mip map generation, 
samples, color samples

//texCamera->attach(buffer, texture.get(), 0, 0, false, 4, 0);
texCamera->attach(buffer, image, 4, 0); // just for testing

// adds the node to the texture camera (this node will be rendered 
to the texture)

texCamera->addChild(node);

if (!root->containsNode(texCamera))
// adds the texture camera to the root node
root->addChild(texCamera);

osgViewer->frame();

// just for testing
osgDB::writeImageFile(*image, "/Users/dst/Downloads/test.bmp");
}

Dominic

Am 05.01.10 07:23, schrieb J.P. Delport:

Hi,

have you tried writing the image in the camera callback? Maybe have a 
look at osgprerender and osgscreencapture.


jp

Dominic Stalder wrote:

Sorry for hesitating, but the time of our project is running ;-)

Someone any idea what I did wrong with the texture / image camera? Or 
is there a problem with the addChild hirarchy?


Thanks a lot

Am 03.01.10 12:05, schrieb Dominic Stalder:

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl clear 
color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), osgViewer->height(), 1,
GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image and 
sets the

rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and writes 
it to

disk. But the image is all black.
Did you omit some code between 'root->addChild()' and 
'writeImageFile'?  There should be a
call to render the frame (like 'osgViewer->frame()') otherwise the 
Image will remain black.



Does anybody see an error or what could be the problem? I also tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is
there a problem with the hirachy:

GL_U_B is fine, this will probably also give you better performance.

Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-04 Thread Dominic Stalder

Sorry for hesitating, but the time of our project is running ;-)

Someone any idea what I did wrong with the texture / image camera? Or is 
there a problem with the addChild hirarchy?


Thanks a lot

Am 03.01.10 12:05, schrieb Dominic Stalder:

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl clear 
color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), osgViewer->height(), 1,
GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image and 
sets the

rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and writes 
it to

disk. But the image is all black.
Did you omit some code between 'root->addChild()' and 
'writeImageFile'?  There should be a
call to render the frame (like 'osgViewer->frame()') otherwise the 
Image will remain black.



Does anybody see an error or what could be the problem? I also tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is
there a problem with the hirachy:

GL_U_B is fine, this will probably also give you better performance.

Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-03 Thread Dominic Stalder

Hi Ulrich

thanks a lot, big mistake ;-)

Now the color is not black any more, but it only takes the gl clear 
color of the the camera. Do I have to set some view matrices?


Dominic

Am 03.01.10 11:50, schrieb Ulrich Hertlein:

Hi Dominic,

a happy new year to you too.

On 2/01/10 10:00 PM, Dominic Stalder wrote:
   

 Image* image = new Image;
 image->allocateImage(osgViewer->width(), osgViewer->height(), 1,
GL_RGBA, GL_UNSIGNED_BYTE);

 // creates a new camera that will render into the image and sets the
rendering settings
 ref_ptr  imgCamera = new Camera;
...
 imgCamera->addChild(rootLighting.get());

 root->addChild(imgCamera.get());

 osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and writes it to
disk. But the image is all black.
 

Did you omit some code between 'root->addChild()' and 'writeImageFile'?  There 
should be a
call to render the frame (like 'osgViewer->frame()') otherwise the Image will 
remain black.

   

Does anybody see an error or what could be the problem? I also tried
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is
there a problem with the hirachy:
 

GL_U_B is fine, this will probably also give you better performance.

Cheers,
/ulrich
___
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] Write to texture file for lightning

2010-01-02 Thread Dominic Stalder

Hi everybody

first of all, happy new year!

I wanted to implement the rendering to image part, so I did the following:

Image* image = new Image;
image->allocateImage(osgViewer->width(), osgViewer->height(), 1, 
GL_RGBA, GL_UNSIGNED_BYTE);


// creates a new camera that will render into the image and sets 
the rendering settings

ref_ptr imgCamera = new Camera;
imgCamera->setReferenceFrame(Transform::ABSOLUTE_RF);
imgCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
imgCamera->setViewport(0, 0, osgViewer->width(), osgViewer->height());
imgCamera->setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);
imgCamera->setRenderOrder(Camera::PRE_RENDER);
imgCamera->attach(Camera::COLOR_BUFFER, image);
imgCamera->addChild(rootLighting.get());

root->addChild(imgCamera.get());

osgDB::writeImageFile(*image, "/Users/xyz/tmp/test.bmp");

It allocates the image with the right size (1400 x 736) and writes it to 
disk. But the image is all black.


Does anybody see an error or what could be the problem? I also tried 
with GL_INT instead of GL_UNSIGNED_BYTE but this didn't work too. Is 
there a problem with the hirachy:


root
||
rootLigthingimgCamera

Thanks a lot and regards
Dominic

 Original-Nachricht 
Betreff:Re: [osg-users] Write to texture file for lightning
Datum:  Wed, 30 Dec 2009 18:33:56 +0100
Von:Ulrich Hertlein 
An: Dominic Stalder 



On 30/12/09 5:15 PM, Dominic Stalder wrote:

 no problem at all ;-) Is it something like this:

 
http://sourceforge.net/apps/mediawiki/delta3d/index.php?title=Tutorial_Render_To_Texture


Yes, except you want to attach an Image instead of a texture to save it to disk.
Thanks for the link btw!

Happy New Year,
Cheers,
/ulrich


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


[osg-users] Animations in OSG

2009-12-30 Thread Dominic Stalder

Hi there

what is the best way to animate osg node. At the moment I'm using the 
QTimer of Qt to transform the object. Is there a better / more efficent 
way to animate object in OSG?


Thanks and best regards
Dominic
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [Fwd: Re: Write to texture file for lightning]

2009-12-28 Thread Dominic Stalder
I need to render a osg:Geometry to an osg::Image and save that to disk, 
is this possible?


I know how to write the image to disk (osgDB::writeImageFile) but first 
of all I need to "generate" the osg:Image.


Regards
Dominic
--- Begin Message ---
On 28/12/09 3:20 PM, Dominic Stalder wrote:
> I would like to write my selfmade lightning to a texture file, so I can
> smooth it with a texture shader.
> 
> Can someone tell my how to do this the simplest way?

osgDB::writeImageFile(const osg::Image& image, const std::string& filename);

Only a few plugins support writing image files, .png is one of them and might 
be a good
choice, since it's also lossless compression.

Cheers,
/ulrich

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


[osg-users] Write to texture file for lightning

2009-12-28 Thread Dominic Stalder

Hi there

I would like to write my selfmade lightning to a texture file, so I can 
smooth it with a texture shader.


Can someone tell my how to do this the simplest way?

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


Re: [osg-users] OT: Merry Christmas

2009-12-24 Thread Dominic Stalder

In Swiss German:

Froe(ö)hlechi Wiehnacht und ae(ä)s guets Noe(ö)is!

Alex Sierra schrieb:

In Spanish:

Feliz Navidad y prospero año nuevo!

Sent from my iPhone

On Dec 24, 2009, at 9:04 AM, "Can T. Oguz" > wrote:



And in Turkish :

Mutlu Yıllar !

2009/12/24 Trajce Nikolov >


Yeah .. Marry Christmas 
or in czech: Vesele Vanoce, and macedonian: Sreken Bozik

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Thu, Dec 24, 2009 at 3:44 PM, Wang Rui mailto:wangra...@gmail.com>> wrote:

Merry Christmas, and best wishes for a Happy New Year!

In Chinese, "Sheng Dan Kuai Le" :-)

Wang Rui
___
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] Simple water effects

2009-12-22 Thread Dominic Stalder

Hi Kim

thanks for your feedback. First of all my time is rare at the moment, we 
are doing our thesis and on the other hand I think you need a pro for 
the integration of the changes into osgOcean ;-)


Regards
Dominic

Kim Bale schrieb:

Hello All,

Did somebody mention water effects?!

I have recognised the CPU usage of osgOcean as a bit of a problem. 
This is due to the osgOcean using one huge vertex/normal array for all 
of the ocean tiles and then copying the vertices for each tile in on 
frame/position changes. It was a rather bad design decision which once 
I had committed to proved too time consuming to change.


However, due to the tillable nature of the FFT ocean surface, this 
isn't necessary. A little while ago I wrote some test cases which 
removed this huge vertex array and replaced it with a single high 
resolution ocean tile which is then instanced for each tile in the 
ocean surface. The different resolution tiles are then supported 
simply by modifying the primitives and positioning the tiles using a 
vertex shader. Since all of the high resolution tiles are precomputed, 
updating the animation of the ocean surface is simply a matter of 
changing the pointer to the next frames vertex array for each of the 
tile primitives.


This is a far more efficient method of updating the surface, 
particularly if you are using a very large surface. 

I have the code for all of this as a prototype, but I don't have the 
time to tidy it up and update library at the moment. If you are 
interested in making these modifications I would be more than happy to 
give you the code and walk you through it, otherwise it'll have to 
wait until I get some time to do it myself.


Regards,

Kim.


2009/12/22 Robert Osfield <mailto:robert.osfi...@gmail.com>>


Hi Dominic,

On Mon, Dec 21, 2009 at 8:43 PM, Dominic Stalder
mailto:dominic.stal...@bluewin.ch>>
wrote:
> I know the amazing looking osgOcean, but for our game it uses to
much CPU.

Might I suggest you engage with the authors/contributors of osgOcean
and find a way of avoiding this overhead.  This almost certainly will
take less time to realize a final solution and will be of benefit to
all osgOcean users.

Cheers,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
<mailto: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] Simple water effects

2009-12-21 Thread Dominic Stalder

Hi Ümit

thanks for the interesting "links", but the habib tuturials are all for 
direct x, right? And I don't see how I have to integrate with OSG (sorry 
for the stupid questions, but I'm a beginer at all...).


I can't find the real worldz examples on the net, do you have the source?

Regards
Dominic

Ümit Uzun schrieb:

Hi Dominic;

As you know there is too much resource on the net. Some of them which 
I can advice you to look,


http://habib.wikidot.com/
OrangeBook (aka GLSL Book) There is Real Worldz chapter which talk 
about rendering ocean in simple and not comprehensive way.

http://www.vterrain.org/Water/

I don't know which way is the best, simple textures, normal mapping or 
shaders? What I would like to see is the sun reflecting the rays on 
the water ;-)  Any help is welcome.
IMHO, you only need Reflection Rays on the water surface with 
Environment mapping and animated texturing. This 3 combination would 
give you best ocean surface as you expect without much CPU usage.


But I really suggest you to use osgOcean, You can turn on/off much of 
rendering  unit. So you can only use reflection and environment 
mapping by toggling off all off other which are needs too much 
processing time.


Regards.

Ümit Uzun


2009/12/21 Dominic Stalder <mailto:dominic.stal...@bluewin.ch>>


Hi there

is there a simple and good looking way to have water effects for
the sea? How do you implement this?

I don't know which way is the best, simple textures, normal
mapping or shaders? What I would like to see is the sun reflecting
the rays on the water ;-)  Any help is welcome.

I know the amazing looking osgOcean, but for our game it uses to
much CPU.

Regards
Dominic
___
osg-users mailing list
osg-users@lists.openscenegraph.org
<mailto: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] Simple water effects

2009-12-21 Thread Dominic Stalder

Hi there

is there a simple and good looking way to have water effects for the 
sea? How do you implement this?


I don't know which way is the best, simple textures, normal mapping or 
shaders? What I would like to see is the sun reflecting the rays on the 
water ;-)  Any help is welcome.


I know the amazing looking osgOcean, but for our game it uses to much CPU.

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


[osg-users] OSG lightning

2009-12-19 Thread Dominic Stalder

Hi there

is there an OSG package for rendering lightning (I mean flashes not 
lighting)? Or does someone have some good examples?


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


Re: [osg-users] osgParticle::FireEffect only one minute

2009-12-14 Thread Dominic Stalder

Hi Robert

thanks a lot, will try to follow your hint ;-)

Regards
Dominic

Robert Osfield schrieb:

Hi Dominic,

On Sun, Dec 13, 2009 at 9:33 PM, Dominic Stalder
 wrote:
  

the osgParticle::FireEffect is disables after one minute, is this normal and
how can I make it "burning" the hole time?




The headers are your friend, you just need to follow them and browse ;-)

FireEffect is subclassed from ParticleEffect which has the method:

void setEmitterDuration(double duration);

Please note, I didn't remember this off the top of my head... I had to
go look at the headers :-)

Robert.
___
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] osgParticle::FireEffect only one minute

2009-12-13 Thread Dominic Stalder

Hi there

the osgParticle::FireEffect is disables after one minute, is this normal 
and how can I make it "burning" the hole time?


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


Re: [osg-users] Transparent skydome

2009-12-13 Thread Dominic Stalder

Exactly what I want to do the next time I will work on it.

Thanks and regards
Dominic

Paul Martz schrieb:

Dominic Stalder wrote:

Hi there

I found out, that it makes a difference if the texture file is loaded 
in the OSG file it self or in the application. If I load it in the 
application the transparency works.


After you load it into your application and get the results you want, 
then dump your scene graph out as a .osg file and compare it to the 
original model to find out what the difference is.

   -Paul

___
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] Transparent skydome

2009-12-12 Thread Dominic Stalder

Hi there

I found out, that it makes a difference if the texture file is loaded in 
the OSG file it self or in the application. If I load it in the 
application the transparency works.


Now it only needs the following settings:

   // sets the state set of the OSG node for the sky and sets the states
   ref_ptr stateSky = geoSky->getOrCreateStateSet();
   stateSky->setTextureAttributeAndModes(0, texSky, StateAttribute::ON);
   stateSky->setMode(GL_LIGHTING, StateAttribute::OFF);
   stateSky->setMode(GL_BLEND, osg::StateAttribute::OFF);
   stateSky->setRenderingHint(StateSet::TRANSPARENT_BIN);

Thanks all for the help.

Regards
Dominic

Dominic Stalder schrieb:

Hi Chris

now I have the following settings:

   ref_ptr blfSky = new BlendFunc(BlendFunc::SRC_ALPHA, 
BlendFunc::ONE_MINUS_SRC_ALPHA);
 // sets the state set of the OSG node for the sky and sets the 
states

   ref_ptr stateSky = geoSky->getOrCreateStateSet();
   stateSky->setAttributeAndModes(blfSky);
   stateSky->setMode(GL_BLEND, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);

   stateSky->setRenderingHint(StateSet::TRANSPARENT_BIN);

but there is no transparency. Even with the setRenderBinDetails(1, 
"DepthSortedBin"); enabled it doesn't work.


I added a material like this:

   // creates a new material for the sky
   ref_ptr material = new Material;
   material->setAlpha(Material::FRONT_AND_BACK, 0.5);
   stateSky->setAttributeAndModes(material, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);


Now there is some transparency, but now also the clouds are half 
transparent, this is not whati want. Any idea?


Regards
Dominic

Chris 'Xenon' Hanson schrieb:

On 12/11/2009 10:15 AM, Dominic Stalder wrote:
 

How can I set the state to include transparency?



  Here's an example:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-June/029244.html 



  You might be able to skip the rendering hint, and the backface cull 
will probably be

beneficial to 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] Transparent skydome

2009-12-12 Thread Dominic Stalder

Hi Chris

now I have the following settings:

   ref_ptr blfSky = new BlendFunc(BlendFunc::SRC_ALPHA, 
BlendFunc::ONE_MINUS_SRC_ALPHA);
  
   // sets the state set of the OSG node for the sky and sets the states

   ref_ptr stateSky = geoSky->getOrCreateStateSet();
   stateSky->setAttributeAndModes(blfSky);
   stateSky->setMode(GL_BLEND, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);

   stateSky->setRenderingHint(StateSet::TRANSPARENT_BIN);

but there is no transparency. Even with the setRenderBinDetails(1, 
"DepthSortedBin"); enabled it doesn't work.


I added a material like this:

   // creates a new material for the sky
   ref_ptr material = new Material;
   material->setAlpha(Material::FRONT_AND_BACK, 0.5);
   stateSky->setAttributeAndModes(material, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);


Now there is some transparency, but now also the clouds are half 
transparent, this is not whati want. Any idea?


Regards
Dominic

Chris 'Xenon' Hanson schrieb:

On 12/11/2009 10:15 AM, Dominic Stalder wrote:
  

How can I set the state to include transparency?



  Here's an example:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-June/029244.html

  You might be able to skip the rendering hint, and the backface cull will 
probably be
beneficial to you.

  


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


Re: [osg-users] Transparent skydome

2009-12-11 Thread Dominic Stalder

Hi Chris

I will try this, thanks a lot.

regards
Dominic

Chris 'Xenon' Hanson schrieb:

On 12/11/2009 10:15 AM, Dominic Stalder wrote:
  

How can I set the state to include transparency?



  Here's an example:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-June/029244.html

  You might be able to skip the rendering hint, and the backface cull will 
probably be
beneficial to you.

  


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


Re: [osg-users] Transparent skydome

2009-12-11 Thread Dominic Stalder

How can I set the state to include transparency?

Chris 'Xenon' Hanson schrieb:

On 12/11/2009 8:53 AM, Dominic Stalder wrote:
  

we use the skydome.osg of the OSG examples. Is it possible to make this
one transparent, so that only the clouds are visible.
We converted the skymap.jpg to a PNG file with a transparent alpha
channel. Instead of a transparent skydome, it's just white where the
transparent color is.
Is it possible to make the skydome.osg transparent in the code and how?




  I think it should be possible. Did you actually set the state of the skydome 
to include
transparency (simply adding an Alpha texture doesn't do it, if I recall). Also, 
skydome is
often set to render FIRST in the scene, and transparent objects need to go into 
the
transparent bin so they are Z-sorted and rendered last in the scene. In this 
case, you
might want to have your skydome not sorted (a dome has no intersecting geometry 
to
required this) and have it render right after whatever you use to define the sky
background color.

  See: StateSet::setRenderBinDetails (and possibly StateSet::setRenderingHint)

  


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


Re: [osg-users] Transparent skydome

2009-12-11 Thread Dominic Stalder

Hi Paul

thanks for the answer, but I don't need any shader in my programm.

Regards
Dominic

Paul Martz schrieb:

Dominic Stalder wrote:

Hi there

we use the skydome.osg of the OSG examples. Is it possible to make 
this one transparent, so that only the clouds are visible.


We converted the skymap.jpg to a PNG file with a transparent alpha 
channel. Instead of a transparent skydome, it's just white where the 
transparent color is.


Sounds like you are using the wrong TexEnv (or applying it wrong in 
your shader, if not using FFP). Maybe you're using decal instead of 
modulate? You'd need to look it up in the blue book, I forget the 
exact formulas for each.

   -Paul

___
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] Transparent skydome

2009-12-11 Thread Dominic Stalder

Hi there

we use the skydome.osg of the OSG examples. Is it possible to make this 
one transparent, so that only the clouds are visible.


We converted the skymap.jpg to a PNG file with a transparent alpha 
channel. Instead of a transparent skydome, it's just white where the 
transparent color is.


Is it possible to make the skydome.osg transparent in the code and how?

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


Re: [osg-users] HeightField texture coordinates

2009-12-07 Thread Dominic Stalder

Hi Ulrich

found the solution, sorry:

   Matrixd matrix;
   matrix.makeScale(Vec3(scaleX, scaleY, 1.0));
  
   ref_ptr matTexture = new TexMat;

   matTexture->setMatrix(matrix);
  
   // creates a new OSG geode

   ref_ptr geoGround = new Geode;
   geoGround->addDrawable(new ShapeDrawable(gridGround));   
  
   // enables all the necessary states
   geoGround->getOrCreateStateSet()->setTextureAttributeAndModes(0, 
texGround.get(), StateAttribute::ON);
   geoGround->getOrCreateStateSet()->setTextureAttributeAndModes(0, 
matTexture.get(), StateAttribute::ON);



Ulrich Hertlein schrieb:

On 6/12/09 7:27 PM, Dominic Stalder wrote:
  

is it possible to set the textue coordinates (for repeating a texture)
of a HeightField node? If yes, how?



If you're using HeightField/ShapeDrawable then no, you cannot specify the 
texture
coordinates manually.  But you can achieve the same by using a TextureMatrix to 
scale the
assigned texcoords to your requirements.

/ulrich
___
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] HeightField texture coordinates

2009-12-07 Thread Dominic Stalder

Hi Ulrich

because the osg website is not reachable (again), can you show me how to 
implement a texture matrix - I didn't find any other sites showing some 
examples.


Here is my code:

// defines the file path
   QString fileGroundTexture = "res/osg/grass.png";
  
   // creates a new OSG height field

   osg::HeightField* gridGround = new osg::HeightField;
   gridGround->allocate(widthX, widthZ);
   gridGround->setXInterval(1.0);
   gridGround->setYInterval(1.0);
  
   // iterates through the rows of the OSG height field

   for(int z=0; z  
   // iterates through the columns of the OSG height field

   for(int x=0; x  
   // defines a terrain for the ground in z-direction

   gridGround->setHeight(x, z, (heightX+heightZ) / 2.0);
   }
   }
  
   // loads the texture image
   ref_ptr imgGroundTexture = 
osgDB::readImageFile(Utilities::filePath(fileGroundTexture).toStdString());
  
   // checks if loading of PNG file was not successful, if so, exit the 
application

   if (!imgGroundTexture)
   Application::alert(Application::ALERT_WARNING, 
QString(QObject::tr("Error openening texture file 
%1.")).arg(Utilities::filePath(fileGroundTexture)));
  
   // attaches the image to the texture

   ref_ptr texGround = new Texture2D;
   texGround->setDataVariance(Object::DYNAMIC);
   texGround->setWrap(Texture::WRAP_S, Texture::REPEAT);
   texGround->setWrap(Texture::WRAP_T, Texture::REPEAT);
   texGround->setImage(imgGroundTexture.get());
   texGround->setUnRefImageDataAfterApply(true);
  
   // creates a new OSG geode

   ref_ptr geoGround = new Geode;
   geoGround->addDrawable(new ShapeDrawable(gridGround));   
  
   // enables all the necessary states
   geoGround->getOrCreateStateSet()->setTextureAttributeAndModes(0, 
texGround.get(), StateAttribute::ON);


Thanks a lot!

Dominic

Ulrich Hertlein schrieb:

On 6/12/09 7:27 PM, Dominic Stalder wrote:
  

is it possible to set the textue coordinates (for repeating a texture)
of a HeightField node? If yes, how?



If you're using HeightField/ShapeDrawable then no, you cannot specify the 
texture
coordinates manually.  But you can achieve the same by using a TextureMatrix to 
scale the
assigned texcoords to your requirements.

/ulrich
___
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] HeightField texture coordinates

2009-12-07 Thread Dominic Stalder

Hi Ulrich

thanks, I forgot the texture matrix again (maybe I try to ignore them ;-))

I will try it.

Regards
Dominic

Ulrich Hertlein schrieb:

On 6/12/09 7:27 PM, Dominic Stalder wrote:
  

is it possible to set the textue coordinates (for repeating a texture)
of a HeightField node? If yes, how?



If you're using HeightField/ShapeDrawable then no, you cannot specify the 
texture
coordinates manually.  But you can achieve the same by using a TextureMatrix to 
scale the
assigned texcoords to your requirements.

/ulrich
___
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] HeightField texture coordinates

2009-12-06 Thread Dominic Stalder

Hi there

is it possible to set the textue coordinates (for repeating a texture) 
of a HeightField node? If yes, how?


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


Re: [osg-users] [osgOcean] How to compile osgOcean

2009-12-02 Thread Dominic Stalder

Hi everyone

I changed the id of the osgOcean library with the otool from osgOcean to 
@executable_path/../Frameworks/osgOcean.framework/Versions/A/osgOcean 
and now it works.


Thanks everybody for the help.

Regards
Dominic

Ulrich Hertlein schrieb:

On 1/12/09 7:13 PM, Dominic Stalder wrote:
  

When I want to start the application the following error occurs:

dyld: Library not loaded: osgOcean
 Referenced from: xxx
 Reason: image not found



This usually means that the respective library can't be found via the 
DYLD_LIBRARY_PATH.

/ulrich
___
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] [osgOcean] How to compile osgOcean

2009-12-02 Thread Dominic Stalder
Yes but osgOcean is correctly installed in /Library/Frameworks. Strange 
is, that with otool -L the following output is given:


osgOcean (compatibility version 0.0.0, current version 0.0.0)

all other osg frameworks are linked with {name}.framework?

Dominic

Ulrich Hertlein schrieb:

On 1/12/09 7:13 PM, Dominic Stalder wrote:
  

When I want to start the application the following error occurs:

dyld: Library not loaded: osgOcean
 Referenced from: xxx
 Reason: image not found



This usually means that the respective library can't be found via the 
DYLD_LIBRARY_PATH.

/ulrich
___
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] [osgOcean] How to compile osgOcean

2009-12-01 Thread Dominic Stalder

Hi all

with Ulrichs hint I was able to compile the osgOcean Freamwork. Now I 
included it in my Qt project and was also able to compile it.


When I want to start the application the following error occurs:

dyld: Library not loaded: osgOcean
 Referenced from: xxx
 Reason: image not found

Any idea on this? I added the resources before I installed osgOcean.

Regards
Dominic

Kim Bale schrieb:

Hi Dominic et al.

What os are you using? Some sort of mac?

Am I right in thinking you're using CMake 2.8? I didn't realise that
had been released yet, I'll have to test.

It's odd because nobody else has reported these errors and I thought
if it worked on Linux it would work on a mac...

I'll have a go with 2.8 to see if the problem arises there.

Kim.



2009/12/1 Ulrich Hertlein :
  

Hi Dominic,

to solve the 'install TARGETS given no FRAMEWORK DESTINATION for shared
library FRAMEWORK target "osgOcean"' error I added the following to
src/osgOcean/CMakeLists.txt:

--- src/osgOcean/CMakeLists.txt (revision 189)
+++ src/osgOcean/CMakeLists.txt (working copy)
@@ -130,6 +130,7 @@
  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgOcean
+  FRAMEWORK DESTINATION "/Library/Frameworks"
 )

 INSTALL(

AFAIK it isn't actually building frameworks though.

Cheers,
/ulrich

On 1/12/09 8:56 AM, Dominic Stalder wrote:


thanks for the feedback. I have the following folder structure:

/
/includes
/resources
/src
/oceanExample
/osgOcean

When i try to first compile in the /srce/osgOcean with cmake . it brings
me the following error:

dst-osx-001:osgocean dst$ cmake src/osgOcean/
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning (dev) at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
Link library type specifier "optimized" is followed by specifier "debug"
instead of a library name. The first specifier will be ignored.
This warning is for project developers. Use -Wno-dev to suppress it.

... more warnings ...

CMake Error at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
The "debug" argument must be followed by a library.


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Regards
Dominic

Tian Ma schrieb:
  

Hi Ice-D:

I think you need to compile the "osgocean" project first, and then the
'example' and 'install' projects.

Cheers,
Tian


Ice-D wrote:


Here some more information.

I think it is not a problem with the FFTSS library, instead cmake has
a problem:

CMake Error at src/osgOcean/CMakeLists.txt:123 (INSTALL):
install TARGETS given no FRAMEWORK DESTINATION for shared library
FRAMEWORK
target "osgOcean".

Does someone know how to solve this?
  

___
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] [osgOcean] How to compile osgOcean

2009-12-01 Thread Dominic Stalder

Hi Ulrich

thanks, I will try it, but if it doesn't build the frameworks, I think 
we have to wait for Kim ;-)


Regards
Dominic

Ulrich Hertlein schrieb:

Hi Dominic,

to solve the 'install TARGETS given no FRAMEWORK DESTINATION for 
shared library FRAMEWORK target "osgOcean"' error I added the 
following to src/osgOcean/CMakeLists.txt:


--- src/osgOcean/CMakeLists.txt (revision 189)
+++ src/osgOcean/CMakeLists.txt (working copy)
@@ -130,6 +130,7 @@
   RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
   ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
   PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgOcean
+  FRAMEWORK DESTINATION "/Library/Frameworks"
 )

 INSTALL(

AFAIK it isn't actually building frameworks though.

Cheers,
/ulrich

On 1/12/09 8:56 AM, Dominic Stalder wrote:

thanks for the feedback. I have the following folder structure:

/
/includes
/resources
/src
/oceanExample
/osgOcean

When i try to first compile in the /srce/osgOcean with cmake . it brings
me the following error:

dst-osx-001:osgocean dst$ cmake src/osgOcean/
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning (dev) at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
Link library type specifier "optimized" is followed by specifier "debug"
instead of a library name. The first specifier will be ignored.
This warning is for project developers. Use -Wno-dev to suppress it.

... more warnings ...

CMake Error at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
The "debug" argument must be followed by a library.


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be 
lower

if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Regards
Dominic

Tian Ma schrieb:

Hi Ice-D:

I think you need to compile the "osgocean" project first, and then the
'example' and 'install' projects.

Cheers,
Tian


Ice-D wrote:

Here some more information.

I think it is not a problem with the FFTSS library, instead cmake has
a problem:

CMake Error at src/osgOcean/CMakeLists.txt:123 (INSTALL):
install TARGETS given no FRAMEWORK DESTINATION for shared library
FRAMEWORK
target "osgOcean".

Does someone know how to solve this?

___
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] [osgOcean] How to compile osgOcean

2009-12-01 Thread Dominic Stalder

Hi Kim

exactly, I am using Mac OS X 10.5.8 with CMake 2.8. Before I used CMake 
2.6 with exactly the same error.


Regards
Dominic

Kim Bale schrieb:

Hi Dominic et al.

What os are you using? Some sort of mac?

Am I right in thinking you're using CMake 2.8? I didn't realise that
had been released yet, I'll have to test.

It's odd because nobody else has reported these errors and I thought
if it worked on Linux it would work on a mac...

I'll have a go with 2.8 to see if the problem arises there.

Kim.



2009/12/1 Ulrich Hertlein :
  

Hi Dominic,

to solve the 'install TARGETS given no FRAMEWORK DESTINATION for shared
library FRAMEWORK target "osgOcean"' error I added the following to
src/osgOcean/CMakeLists.txt:

--- src/osgOcean/CMakeLists.txt (revision 189)
+++ src/osgOcean/CMakeLists.txt (working copy)
@@ -130,6 +130,7 @@
  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgOcean
+  FRAMEWORK DESTINATION "/Library/Frameworks"
 )

 INSTALL(

AFAIK it isn't actually building frameworks though.

Cheers,
/ulrich

On 1/12/09 8:56 AM, Dominic Stalder wrote:


thanks for the feedback. I have the following folder structure:

/
/includes
/resources
/src
/oceanExample
/osgOcean

When i try to first compile in the /srce/osgOcean with cmake . it brings
me the following error:

dst-osx-001:osgocean dst$ cmake src/osgOcean/
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning (dev) at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
Link library type specifier "optimized" is followed by specifier "debug"
instead of a library name. The first specifier will be ignored.
This warning is for project developers. Use -Wno-dev to suppress it.

... more warnings ...

CMake Error at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
The "debug" argument must be followed by a library.


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Regards
Dominic

Tian Ma schrieb:
  

Hi Ice-D:

I think you need to compile the "osgocean" project first, and then the
'example' and 'install' projects.

Cheers,
Tian


Ice-D wrote:


Here some more information.

I think it is not a problem with the FFTSS library, instead cmake has
a problem:

CMake Error at src/osgOcean/CMakeLists.txt:123 (INSTALL):
install TARGETS given no FRAMEWORK DESTINATION for shared library
FRAMEWORK
target "osgOcean".

Does someone know how to solve this?
  

___
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] [osgOcean] How to compile osgOcean

2009-11-30 Thread Dominic Stalder

Hi Tian

thanks for the feedback. I have the following folder structure:

/
   /includes
   /resources
   /src
  /oceanExample
  /osgOcean

When i try to first compile in the /srce/osgOcean with cmake . it brings 
me the following error:


dst-osx-001:osgocean dst$ cmake src/osgOcean/
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning (dev) at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
 Link library type specifier "optimized" is followed by specifier "debug"
 instead of a library name.  The first specifier will be ignored.
This warning is for project developers.  Use -Wno-dev to suppress it.

... more warnings ...

CMake Error at CMakeLists.txt:105 (TARGET_LINK_LIBRARIES):
 The "debug" argument must be followed by a library.


CMake Warning (dev) in CMakeLists.txt:
 No cmake_minimum_required command is present.  A line of code such as

   cmake_minimum_required(VERSION 2.8)

 should be added at the top of the file.  The version specified may be 
lower

 if you wish to support older CMake versions for this project.  For more
 information run "cmake --help-policy CMP".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Regards
Dominic

Tian Ma schrieb:

Hi Ice-D:

I think you need to compile the "osgocean" project first, and then the 
'example' and 'install' projects.

Cheers,
Tian


Ice-D wrote:
  

Here some more information.

I think it is not a problem with the FFTSS library, instead cmake has a problem:

CMake Error at src/osgOcean/CMakeLists.txt:123 (INSTALL):
  install TARGETS given no FRAMEWORK DESTINATION for shared library FRAMEWORK
  target "osgOcean".

Does someone know how to solve this?




--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20617#20617





___
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] [osgOcean] How to compile osgOcean

2009-11-30 Thread Dominic Stalder
Here some more information.

I think it is not a problem with the FFTSS library, instead cmake has a problem:

CMake Error at src/osgOcean/CMakeLists.txt:123 (INSTALL):
  install TARGETS given no FRAMEWORK DESTINATION for shared library FRAMEWORK
  target "osgOcean".

Does someone know how to solve this?

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20616#20616





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


[osg-users] How to compile osgOcean

2009-11-30 Thread Dominic Stalder

Hi there

I compiled the fftss library and just wanted to compile the osgOcean 
library.


How do I have to use CMake for that, I'm sorry for this stupid question.

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


Re: [osg-users] Trees, Grass and Shadows

2009-11-23 Thread Dominic Stalder

Hi Peter

I can't help you with your problem. I am a newbie to OSG, but I'm 
actually trying to have a nice (back)ground for our scene and thought 
that grass and a tree would look very nice. And I have to say that your 
video looks amazing!


Where can I find some helpful information for modeling the grass with 
billboards and how did you create the shadows, with osgShadow or a shader?


Thanks and regards
Dominic

Peter Wraae Marino schrieb:

Hi osgUsers,

I have question about rendering shadows on grass billboards. This is
not a question about anything missing or not working in
OpenSceneGraph, but a question how to solve a problem with shadows and
grass.

The problem is the grass are created using a shader that creates
billboard instances, so all grass you see in the video are billboards.
When the shadowmap is applied to the grass billboard I get streaks at
certain camera angles. Does anyone know how to fix this problem so the
grass looks more natural on a grass billboard.

Here is the video:
http://www.youtube.com/watch?v=iuEVJ-2xQO0

regards,
Peter Wraae Marino

  


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


Re: [osg-users] Texture wrapping for a geometry object

2009-11-23 Thread Dominic Stalder
Hi everybody

thanks for the help. It's really that easy, but I didn't see the hint ;-)

Sorry for that. Now I just set the value of the geometry width instead just 1.0.

Cheers,
Dominic

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20132#20132





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


Re: [osg-users] Texture wrapping for a geometry object

2009-11-23 Thread Dominic Stalder

Hi Robert

thanks a lot, I got it from this mailing list message:

http://www.mail-archive.com/osg-us...@openscenegraph.net/msg11209.html

I will try the texture coordinates scaling. But just for interesting, 
how would the texture matrix work, do you have some basic code snippet?


Regards
Dominic

Robert Osfield schrieb:

Hi Dominc,

I don't know where you might have got the impression that you can't
set up texture repeats with geometry - you just using texture
coordinates beyond the 0.0 to 1.0 range and you'll get repeats.
Another way is to use a texture matrix to up the tex coords from 0.0
to 1.0 range to what you want.

Robert.

On Sun, Nov 22, 2009 at 3:28 PM, Dominic Stalder
 wrote:
  

Hi there

I would like to wrap (repeated) my texture image on a geometry object. I
read somewhere, that this is not possible directly on the geometry, but how
can I do it otherwise? Here is my code:

  /*
   * creates the ground geometry
   */
  // creates the vertices array
  ref_ptr verticesGround = new Vec3Array;
  verticesGround->push_back(Vec3(-WORLD_INFINITY, 0.0, -WORLD_INFINITY)); //
back left
  verticesGround->push_back(Vec3(WORLD_INFINITY, 0.0, -WORLD_INFINITY));  //
back right
  verticesGround->push_back(Vec3(WORLD_INFINITY, 0.0, WORLD_INFINITY));   //
front right
  verticesGround->push_back(Vec3(-WORLD_INFINITY, 0.0, WORLD_INFINITY));  //
front left
// creates the normal array
  ref_ptr normalsGround = new Vec3Array;
  normalsGround->push_back(Vec3(0.0, 1.0, 0.0));
// creates the texture coordinates array
  ref_ptr texCoordGround = new Vec2Array;
  texCoordGround->push_back(Vec2(0.0, 0.0));
  texCoordGround->push_back(Vec2(1.0, 0.0));
  texCoordGround->push_back(Vec2(1.0, 1.0));
  texCoordGround->push_back(Vec2(0.0, 1.0));
// loads the texture image
  ref_ptr imgGrass =
osgDB::readImageFile(Utilities::filePath("res/osg/grass.png").toStdString());
// attaches the image to the texture
  ref_ptr texGround = new Texture2D;
  texGround->setDataVariance(Object::DYNAMIC);
  texGround->setWrap(Texture::WRAP_S, Texture::REPEAT);
  texGround->setWrap(Texture::WRAP_T, Texture::REPEAT);
  texGround->setImage(imgGrass.get());
// releases the image after applying
  texGround->setUnRefImageDataAfterApply(true);
// creates the geometry
  ref_ptr geomGround = new Geometry;
  geomGround->setVertexArray(verticesGround.get());
  geomGround->setNormalArray(normalsGround.get());
  geomGround->setTexCoordArray(0, texCoordGround.get());

  // adds the primitive set to the geometry
  geomGround->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS, 0, 4));
// enables all the necessary states for the ground geometry node
  ref_ptr stateGroundGeometry = geomGround->getOrCreateStateSet();
  stateGroundGeometry->setTextureAttributeAndModes(0, texGround.get(),
StateAttribute::ON);

  // creates the geode
  ref_ptr geoGround = new Geode;
  geoGround->addDrawable(geomGround.get());

Thanks a lot in advance!

Best regards
Dominic
___
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] Texture wrapping for a geometry object

2009-11-22 Thread Dominic Stalder

Hi there

I would like to wrap (repeated) my texture image on a geometry object. I 
read somewhere, that this is not possible directly on the geometry, but 
how can I do it otherwise? Here is my code:


   /*
* creates the ground geometry
*/
   // creates the vertices array
   ref_ptr verticesGround = new Vec3Array;
   verticesGround->push_back(Vec3(-WORLD_INFINITY, 0.0, 
-WORLD_INFINITY)); // back left
   verticesGround->push_back(Vec3(WORLD_INFINITY, 0.0, 
-WORLD_INFINITY));  // back right
   verticesGround->push_back(Vec3(WORLD_INFINITY, 0.0, 
WORLD_INFINITY));   // front right
   verticesGround->push_back(Vec3(-WORLD_INFINITY, 0.0, 
WORLD_INFINITY));  // front left
  
   // creates the normal array

   ref_ptr normalsGround = new Vec3Array;
   normalsGround->push_back(Vec3(0.0, 1.0, 0.0));
  
   // creates the texture coordinates array

   ref_ptr texCoordGround = new Vec2Array;
   texCoordGround->push_back(Vec2(0.0, 0.0));
   texCoordGround->push_back(Vec2(1.0, 0.0));
   texCoordGround->push_back(Vec2(1.0, 1.0));
   texCoordGround->push_back(Vec2(0.0, 1.0));
  
   // loads the texture image
   ref_ptr imgGrass = 
osgDB::readImageFile(Utilities::filePath("res/osg/grass.png").toStdString()); 

  
   // attaches the image to the texture

   ref_ptr texGround = new Texture2D;
   texGround->setDataVariance(Object::DYNAMIC);
   texGround->setWrap(Texture::WRAP_S, Texture::REPEAT);
   texGround->setWrap(Texture::WRAP_T, Texture::REPEAT);
   texGround->setImage(imgGrass.get());
  
   // releases the image after applying

   texGround->setUnRefImageDataAfterApply(true);
  
   // creates the geometry

   ref_ptr geomGround = new Geometry;
   geomGround->setVertexArray(verticesGround.get());
   geomGround->setNormalArray(normalsGround.get());
   geomGround->setTexCoordArray(0, texCoordGround.get());

   // adds the primitive set to the geometry
   geomGround->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS, 0, 4));
  
   // enables all the necessary states for the ground geometry node
   ref_ptr stateGroundGeometry = 
geomGround->getOrCreateStateSet();
   stateGroundGeometry->setTextureAttributeAndModes(0, texGround.get(), 
StateAttribute::ON);


   // creates the geode
   ref_ptr geoGround = new Geode;
   geoGround->addDrawable(geomGround.get());

Thanks a lot in advance!

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


Re: [osg-users] Deploy OSG application

2009-11-21 Thread Dominic Stalder

Hi Stephan

here the answer of my workmate:

I tried this without luck. After compiling the Frameworks and using them 
in my application, I get the following linking errors when building with 
Xcode:


Undefined symbols:
"non-virtual thunk to osgViewer::Viewer::~Viewer()"
"osgDB::readImageFile(std::basic_string, 
std::allocator > const&, osgDB::Options const*)"
"osgText::readFontFile(std::basic_string, 
std::allocator > const&, osgDB::Options const*)"

"osgViewer::Viewer::checkNeedToDoFrame()"
"non-virtual thunk to osgViewer::Viewer::setStartTick(unsigned long long)"
"non-virtual thunk to osgViewer::Viewer::setSceneData(osg::Node*)"

(See complete compiler output attached)

The same also happens when using the pre-compiled binaries from 
http://www.cuboslocos.com



You can use a similar technique with the dylibs created by the
cmake-build, but you'll have to adjust the paths via install_name_tool.


Also tried that. Compiled the dylibs with cmake and installed them in 
/usr/local/lib. Compiling and linking against them works fine. For 
packaging I copied them to the application bundle (to Contents/MacOS/) 
and changed all paths using install_name_tool. Starting the application 
does not show any linking errors but the following runtime error occurs:


Exception Type:  EXC_BAD_ACCESS (SIGBUS)

Thread 0 Crashed:
0   libosg.61.dylib  0x0036bda5 osg::Node::getOrCreateStateSet() + 21
1   

When starting the application with the default references to 
/usr/local/lib/libosg* there are no such runtime errors.


Or you create an installer package which copies the dylibs / frameworks
to known places like /Library/Frameworks or /usr/lib


This is currently not an option :-(

~Thomas

Stephan Maximilian Huber schrieb:

Dominic Stalder schrieb:
  

we are trying to deploy an OSG application on Mac OS X to another
system, where OSG is not installed.

What is the best way to distribute the application, should we use static
OSG linking (makes the file huge) or are there other / better ways?



I haven't tried static builds on OS X, so I can't comment on them.

If you are using the deprecated xcode-projects to build osg as
frameworks you can embed them into your application bundle and
distribute it. This gives you a double-clickable app qhich you can copy
wherever you want, no installation-step necessary.

You just add a new copy-phase into your xcode-project of your app, set
it's target to Frameworks and add all osg-related frameworks to it. (and
the plugins goes into a subfolder plugins of the bundle)

You can use a similar technique with the dylibs created by the
cmake-build, but you'll have to adjust the paths via install_name_tool.

Or you create an installer package which copies the dylibs / frameworks
to known places like /Library/Frameworks or /usr/lib


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

  


cd /Volumes/data/myosgproject
/Developer/usr/bin/g++-4.0 -arch i386 
-L/Volumes/data/myosgproject/build/Release -L/Library/Frameworks 
-L/System/Library/Frameworks -F/Volumes/data/myosgproject/build/Release 
-filelist 
/Volumes/data/myosgproject/tmp/obj/wiitetris.build/Release/wiitetris.build/Objects-normal/i386/wiitetris.LinkFileList
 -mmacosx-version-min=10.3 -headerpad_max_install_names -L/Library/Frameworks 
-F/Library/Frameworks -lz -lm -framework IOBluetooth -framework OpenThreads 
-framework osg -framework osgViewer -framework osgText -framework osgGA 
-framework osgDB -framework osgUtil -framework QtSvg -framework QtSql 
-framework QtOpenGL -framework QtGui -framework Carbon -framework AppKit 
-framework QtCore -framework ApplicationServices -framework OpenGL -framework 
AGL -o 
/Volumes/data/myosgproject/build/Release/wiitetris.app/Contents/MacOS/wiitetris
Undefined symbols:
  "non-virtual thunk to osgViewer::Viewer::~Viewer()", referenced from:
  construction vtable for osgViewer::Viewer-in-QwtGLWidgetin 
moc_qwtglwidget.o
  "non-virtual thunk to osgViewer::Viewer::~Viewer()", referenced from:
  construction vtable for osgViewer::Viewer-in-QwtGLWidgetin 
moc_qwtglwidget.o
  "osgDB::readImageFile(std::basic_string, 
std::allocator > const&, osgDB::Options const*)", referenced from:
  osgDB::readImageFile(std::basic_string, 
std::allocator > const&)in gameview.o
  "osgText::readFontFile(std::basic_string, 
std::allocator > const&, osgDB::Options const*)", referenced from:
  OsgOverlay::OsgOverlay()in osgoverlay.o
  "osgViewer::Viewer::checkNeedToDoFrame()", referenced from:
  construction vtable for osgViewer::Viewer-in-QwtGLWidgetin 
moc_qwtglwidget.o
  vtable for QwtGLWidgetin moc_qwtglwidget.o
  "non-virtual thunk to osgViewer::

Re: [osg-users] Deploy OSG application

2009-11-21 Thread Dominic Stalder

Hi Stephan

thanks a lot for the feedback, we will try this. If we get some 
problems, I will get back to this post.


Regards
Dominic

Stephan Maximilian Huber schrieb:

Dominic Stalder schrieb:
  

we are trying to deploy an OSG application on Mac OS X to another
system, where OSG is not installed.

What is the best way to distribute the application, should we use static
OSG linking (makes the file huge) or are there other / better ways?



I haven't tried static builds on OS X, so I can't comment on them.

If you are using the deprecated xcode-projects to build osg as
frameworks you can embed them into your application bundle and
distribute it. This gives you a double-clickable app qhich you can copy
wherever you want, no installation-step necessary.

You just add a new copy-phase into your xcode-project of your app, set
it's target to Frameworks and add all osg-related frameworks to it. (and
the plugins goes into a subfolder plugins of the bundle)

You can use a similar technique with the dylibs created by the
cmake-build, but you'll have to adjust the paths via install_name_tool.

Or you create an installer package which copies the dylibs / frameworks
to known places like /Library/Frameworks or /usr/lib


HTH,
Stephan
___
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] Deploy OSG application

2009-11-20 Thread Dominic Stalder

Hi there

we are trying to deploy an OSG application on Mac OS X to another 
system, where OSG is not installed.


What is the best way to distribute the application, should we use static 
OSG linking (makes the file huge) or are there other / better ways?


Thanks a lot!
Dominic
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Disable Backface Culling of a node

2009-11-13 Thread Dominic Stalder

Hi Glenn

thanks but this didn't work. We applied the mode on a loaded osg file. 
Is this a problem?


Glenn Waldron schrieb:
node->getOrCreateStateSet()->setMode( GL_CULL_FACE, 
osg::StateAttribute::OFF );



Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 
+1.703.652.4791



On Fri, Nov 13, 2009 at 12:59 PM, Dominic Stalder 
mailto:dominic.stal...@bluewin.ch>> wrote:


Hi there

is there a way to disable the backface culling of a node? If we
enable some transparency in a box, we want to see the back face.
Will there be a problem, if we use lighting, does the back face be
visible with the material color?

Thanks a lot and regards
Dominic
___
osg-users mailing list
osg-users@lists.openscenegraph.org
<mailto: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] Disable Backface Culling of a node

2009-11-13 Thread Dominic Stalder

Hi there

is there a way to disable the backface culling of a node? If we enable 
some transparency in a box, we want to see the back face. Will there be 
a problem, if we use lighting, does the back face be visible with the 
material color?


Thanks a lot and regards
Dominic
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Phong and Gouraud Shader question

2009-11-13 Thread Dominic Stalder

Hi Paulo

thanks for your feedback, I will try the shader.

Regards
Dominic

Paulo Silva schrieb:

Hi,

GL by default uses either GL_SMOOTH
http://www.opengl.org/sdk/docs/man/xhtml/glShadeModel.xml
Probably osg also uses the default value.
GL_SMOOTH calculates the light at each vertex and interpolates the value in the 
primitive, also called Gouraud shading
http://en.wikipedia.org/wiki/Gouraud_shading
While the Phong shading interpolates not the color but the normals in the 
primitive
http://en.wikipedia.org/wiki/Phong_reflection_model

I do happen to have a phong shader lying around, but only for one light.
But you can find it anywhere, both books and web...
(vert)
varying vec3 v_V;
varying vec3 v_N;

void main() {
gl_Position = ftransform();
v_V = (gl_ModelViewMatrix * gl_Vertex).xyz;
v_N = gl_NormalMatrix * gl_Normal;
}


(frag)
varying vec3 v_V;
varying vec3 v_N;

void main() {
vec3 N = normalize(v_N);
vec3 V = normalize(v_V);
vec3 R = reflect(V, N);
vec3 L = normalize(vec3(gl_LightSource[0].position));

vec4 ambient = gl_FrontMaterial.ambient;
vec4 diffuse = gl_FrontMaterial.diffuse * max(dot(L, N), 0.0);
vec4 specular = gl_FrontMaterial.specular
* pow(max(dot(R, L), 0.0), gl_FrontMaterial.shininess);

gl_FragColor = ambient + diffuse + specular;
}

Cheers,
Paulo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19598#19598





___
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] Phong and Gouraud Shader question

2009-11-12 Thread Dominic Stalder

Hi there

I implemented a Phong Shader and activated it in OSG. In fact the shader 
is working, but not the way I expected. Does OSG has a standard Phong 
Shader implemented, because there are no differences when I enable or 
disable the shader. When I change some values in the shader, this is 
recognized.


Now I'm not sure if I have a correct implementation. Does anybody have a 
phong shader or even gouraud shader implemented for multiple lights, to 
see what I am doing wrong?


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


Re: [osg-users] OSG with QGLWidget and Anti Aliasing

2009-11-11 Thread Dominic Stalder
Sorry, searched on the wrong framework. I could solve the problem in Qt 
itself:


QGLFormat fmt;
QGLFormat::setDefaultFormat(fmt);
fmt.setSamples(4);
fmt.setSampleBuffers(true);

qglwidget->setFormat(fmt);



Hi there

I am absolutly new to the OSG stuff (and it's the first time I attend in 
a mailing list) and trying to get my OSG work in a Qt environment. I 
made my own OSG/Qt class, which inherits from QGLWidget and 
osgViewer::Viewer. Most of the OSG stuff works, but I can't enable the 
anti aliasing or the multi sampling.


I tried the following two configurations:

1.
ref_ptr< DisplaySettings > displaySettings = new DisplaySettings;
displaySettings->setNumMultiSamples(16);
modelView->setDisplaySettings( displaySettings.get() );

2.
osg::DisplaySettings::instance()->setNumMultiSamples(8);

But this didn't work. Does anybody had the same problems or have some 
ideas to solve this problem. I attached my class and header files.


If I'm doing something wrong concerning the "mailing list rules", just 
let me know.


Thanks a lot and regards
Dominic
  



___
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] multisampling in embedded window?

2009-11-11 Thread Dominic Stalder
Hi Raphael

I have exactly the same problem, how did you solve it?

Thanks a lot in advance
Dominic

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19471#19471





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