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

2010-01-06 Thread 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_ptrNode node, 
ref_ptrTexture2D texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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




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


This message has been scanned for viruses and dangerous 

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_ptrNode node, 
ref_ptrTexture2D texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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-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_ptrNode node, ref_ptrTexture2D 
texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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-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_ptrNode node, 
ref_ptrTexture2D texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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
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_ptrNode node, 
ref_ptrTexture2D texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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 J.P. Delport

Hi,

I can't help more than by pointing you to the working osgprerender.
Start from that and modify as needed. You don't need to call frame()
manually in you own rendering, just attach the RTT camera to your scene.

jp

Dominic Stalder wrote:
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_ptrNode node, 
ref_ptrTexture2D texture, Camera::BufferComponent buffer)

{
// just for testing
ref_ptrImage 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_ptrCamera  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




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


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



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_ptrCamera  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-04 Thread 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_ptrCamera  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



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


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


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


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

2010-01-03 Thread 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_ptrCamera 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


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_ptrCamera  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_ptrCamera 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 u.hertl...@sandbox.de
An: Dominic Stalder dominic.stal...@bluewin.ch



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] 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] Write to texture file for lightning

2009-12-28 Thread Ulrich Hertlein
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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org