[osg-users] osgParticle

2008-10-07 Thread Роман Григорьев
Good day!

I built custom particle system like in tutorials on osg site
Now I'd like to control it using event handlers 
For example when I press a key I'd like to emit particle
What's the best way to do it?
Thanx in advance
Bye



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


[osg-users] Simple question about osg window under vista

2008-06-11 Thread Роман Григорьев
Hi guys!
Could you please provide me answers how to make this thing under vista
I create viewer using this
viewer.setUpViewInWindow(0,0,vp_Width,vp_Height); and use windows dialogs to
control state of my application. I use clone mode to connect primary and
secondary display. For example my screen resolution 800x600 so when I create
in osg window 800*600 I still see status bar with startup button but I don't
want to see it. When I try to use fullscreen mode my dialogs becomes behind
osg window and I can't see them.
What should I do?
Thanx in advance
Bye



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


Re: [osg-users] FBO Rendering

2008-05-21 Thread Роман Григорьев
Hi!
Today I tried to adapt you example to texture2D as input textures and 
rendertargets but no luck. With texture2Drect works fine but with texture2d it 
doesn’t work at all. I use 8600GT under vista with 174 drivers(osg svn)
Roman
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
Sent: Tuesday, May 20, 2008 5:29 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] FBO Rendering

Hi Roman,

attached is an example I made that uses ping-pong rendering. It tries to 
simulate the game of life, see e.g.

http://en.wikipedia.org/wiki/Conway's_Game_of_Life

Each iteration depends on the previous one.

I hope the code makes sense. At least the output looks pretty :)

regards
jp

Роман Григорьев wrote:
 Sorry guys for my f**king outlook
 Here is shaders and source u can take from 1-st message Roman
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
 Sent: Tuesday, May 20, 2008 2:17 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering
 
 Hi,
 
 sorry, I cannot read the attachments in your mail. I will try to make a 
 simple ping-pong example instead.
 
 jp
 
 Roman Grigoriev wrote:
 Here is my shaders. It's shaders from my current version that do not use 
 MRT. 
 Source code you can take from my previous messageÎÅÉIf you want to have my 
 setup with FBO MRT just email me. ÎÅÉÎÅÉÎÅÉÎÅÉ-Original 
 Message-ÎÅÉFrom: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 DelportÎÅÉSent: Tuesday, May 20, 2008 1:46 PMÎÅÉTo: OpenSceneGraph 
 UsersÎÅÉSubject: Re: [osg-users] FBO RenderingÎÅÉÎÅÉHi,ÎÅÉÎÅÉòÏÍÁÎ 
 çÒÉÇÏÒØÅ× wrote:ÎÅÉ Hi I try to implement cellular automata clouds on OSG 
 and have some problemÎÅÉ ÎÅÉ 1) I can't use (or don't know)  ping-pong 
 rendering technique as ÎÅÉ described here 
 http://www.m3xbox.com/GPU_blog/?m=200712ÎÅÉ ÎÅÉ Because when I attach 2 
 textures to camera FBO in rendering loop camera ÎÅÉ render to 2 FBO but I 
 need to change dynamically which draw buffer I ÎÅÉ need to draw/ 
 ÎÅÉÎÅÉCan 
 you not also pass the draw buffer as a uniform to the shader and ÎÅÉthen 
 use 
 that in glFragData[buffer] call? This can select which of two ÎÅÉtextures 
 to 
 render to.ÎÅÉÎÅÉ I've red about RenderStage but how to control it is 
 ÎÅÉ 
 unclear for me. I've make a workaround that create another camera that ÎÅÉ 
 render FBO texture to another FBO texture that can I attach in 1 stage ÎÅÉ 
 to calculate cellular automata.ÎÅÉÎÅÉIf you have the same shader code for 
 both cameras, I think you can get ÎÅÉaway with only a single camera and 
 multiple targets.ÎÅÉÎÅÉ ÎÅÉ 2) I'd like to do RTT rendering not in 
 every 
 frame. But As I understand ÎÅÉ OSG create rendercashe to strore rendering 
 order how can I dynamically ÎÅÉ attach and remove camera from rendering 
 order?  ÎÅÉÎÅÉSwitching on and off could be done with Switch node or mask 
 as 
 Robert ÎÅÉsaid. Not sure about switching order dynamically, but I'm still 
 not 
 sure ÎÅÉyou need it.ÎÅÉÎÅÉ ÎÅÉ See my example. If anyone is interested 
 in my program I can share.ÎÅÉÎÅÉIf you could send me a simple version of 
 your shader I can have a look.ÎÅÉÎÅÉjpÎÅÉÎÅÉ ÎÅÉ Thanx in 
 advanceÎÅÉ 
 ÎÅÉ RomanÎÅÉ ÎÅÉ 
 ÎÅÉ 
 ÎÅÉ
  
 ÎÅÉ ___ÎÅÉ 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[EMAIL 
 PROTECTED]ÎÅÉhttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.orgÎÅÉ


 begin 666 cell_fp.glsl
 M#0HO*D9204=-14Y47U-([EMAIL PROTECTED]/+@(.[AZ^#W[[EMAIL PROTECTED]G5N
 M:69OFT@V%MQEC)$($-E;Q?=5X.PT*+R_JX/#RX[EMAIL PROTECTED]
 M;FEF;W)M('-A;7!L97(R1!.;[EMAIL PROTECTED]@\/+@(.[C\.#MZ/?H
 MXN#^^7C[B#NX?KE[. -G5N:69OFT@V%MQEC)$($5L:7!S;VED7W1E
 M#L-@T*=6YI9F]R;2!F;]A=!D=EM93L-@T*+R_QZ_/[EMAIL PROTECTED]SE
 M^7MZ/[EMAIL PROTECTED]@[EMAIL 
 PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X
 [EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X=%D[#0IU;FEF;W)M
 M(9L;V%T(9.;VES94]F9G-E=$AU;[EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES
 M94]F9G-E=$AU;5D[#0IU;FEF;W)M(9L;V%T(9.;[EMAIL PROTECTED]
 M#0IU;FEF;W)M(9L;V%T(9.;VES94]F9G-E=$%C=%D[#0H-B\O\.#G[.7P
 M^R#QZ^[_(.[AZ^#J[N(-G5N:69OFT@:6YT(9396=M96YT5VED=@[#0IU
 M;FEF;W)M(EN=!F4V5G;65N=$AE:[EMAIL PROTECTED]B\O\.#G[.7P^R#JX/#R
 M^R#NX[EMAIL PROTECTED];FEF;W)M(EN=!F5VED

Re: [osg-users] FBO Rendering

2008-05-21 Thread Роман Григорьев
Thanx JP. Sorry for my mistake (forget about texture coordinates in fragment 
shader that differ from texture rectangle to texture2D) but all your example 
works fine and have same framerate 1000 fps.
I try to modify my example to see my framerates to choose method of rendering.
Thanx 
Bye
Roman
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
Sent: Wednesday, May 21, 2008 12:28 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] FBO Rendering

Hi, 

attached is the new version of the example. I think this should work fine with 
Texture2D as well. No MRT is used, only two FBO's that are switched between 
frames.

Hope this helps.

regards
jp

J.P. Delport wrote:
 Hi,
 
 I think my example does not use FBO in the correct way. It does not 
 seem to be good to attach textures as both input and output. For 
 example in my demo the output is not always the same.
 
 I have made a new example that uses two cameras with switches above 
 them to do ping-pong and this works much better. I get the same 
 results every time.
 
 See here for good explanation of ping-pong:
 http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html#fe
 edback2
 
 
 The new example uses the first method described here:
 Use one FBO with one attachment per texture that is rendered to, and 
 bind a different FBO in each rendering pass.
 
 I will send this soon. Just cleaning it up.
 
 jp
 
 Роман Григорьев wrote:
 Hi!
 Today I tried to adapt you example to texture2D as input textures and 
 rendertargets but no luck. With texture2Drect works fine but with 
 texture2d it doesn’t work at all. I use 8600GT under vista with 174 
 drivers(osg svn) Roman
  

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 Delport
 Sent: Tuesday, May 20, 2008 5:29 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering

 Hi Roman,

 attached is an example I made that uses ping-pong rendering. It tries 
 to simulate the game of life, see e.g.

 http://en.wikipedia.org/wiki/Conway's_Game_of_Life

 Each iteration depends on the previous one.

 I hope the code makes sense. At least the output looks pretty :)

 regards
 jp

 Роман Григорьев wrote:
 Sorry guys for my f**king outlook
 Here is shaders and source u can take from 1-st message Roman


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 Delport
 Sent: Tuesday, May 20, 2008 2:17 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering

 Hi,

 sorry, I cannot read the attachments in your mail. I will try to make 
 a simple ping-pong example instead.

 jp

 Roman Grigoriev wrote:
 Here is my shaders. It's shaders from my current version that do not 
 use MRT. Source code you can take from my previous messageÎÅÉIf you 
 want to have my setup with FBO MRT just email me. 
 ÎÅÉÎÅÉÎÅÉÎÅÉ-Original Message-ÎÅÉFrom: 
 [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 J.P. DelportÎÅÉSent: Tuesday, May 20, 2008 1:46 PMÎÅÉTo: 
 OpenSceneGraph UsersÎÅÉSubject: Re: [osg-users] FBO 
 RenderingÎÅÉÎÅÉHi,ÎÅÉÎÅÉòÏÍÁÎ çÒÉÇÏÒØÅ× wrote:ÎÅÉ Hi I try to 
 implement cellular automata clouds on OSG and have some problemÎÅÉ 
 ÎÅÉ 1) I can't use (or don't know)  ping-pong rendering technique 
 as ÎÅÉ described here 
 http://www.m3xbox.com/GPU_blog/?m=200712ÎÅÉ ÎÅÉ Because when I 
 attach 2 textures to camera FBO in rendering loop camera ÎÅÉ 
 render to 2 FBO but I need to change dynamically which draw buffer I 
 ÎÅÉ need to draw/ ÎÅÉÎÅÉCan you not also pass the draw buffer as 
 a uniform to the shader and ÎÅÉthen use that in glFragData[buffer] 
 call? This can select which of two ÎÅÉtextures to render 
 to.ÎÅÉÎÅÉ I've red about RenderStage but how to control it is 
 ÎÅÉ unclear for me. I've make a workaround that create another 
 camera that ÎÅÉ render FBO texture to another FBO texture that can 
 I attach in 1 stage ÎÅÉ to calculate cellular automata.ÎÅÉÎÅÉIf 
 you have the same shader code for both cameras, I think you can get 
 ÎÅÉaway with only a single camera and multiple targets.ÎÅÉÎÅÉ 
 ÎÅÉ 2) I'd like to do RTT rendering not in every frame. But As I 
 understand ÎÅÉ OSG create rendercashe to strore rendering order 
 how can I dynamically ÎÅÉ attach and remove camera from rendering 
 order?  ÎÅÉÎÅÉSwitching on and off could be done with Switch node 
 or mask as Robert ÎÅÉsaid. Not sure about switching order 
 dynamically, but I'm still not sure ÎÅÉyou need it.ÎÅÉÎÅÉ ÎÅÉ 
 See my example. If anyone is interested in my program I can 
 share.ÎÅÉÎÅÉIf you could send me a simple version of your shader I 
 can have a look.ÎÅÉÎÅÉjpÎÅÉÎÅÉ ÎÅÉ Thanx in advanceÎÅÉ 
 ÎÅÉ RomanÎÅÉ ÎÅÉ ÎÅÉ 
 ÎÅÉ
  
 ÎÅÉ ___ÎÅÉ osg-users 
 mailing listÎÅÉ osg-users@lists.openscenegraph.orgÎÅÉ 
 http://lists.openscenegraph.org/listinfo.cgi

Re: [osg-users] FBO Rendering

2008-05-21 Thread Роман Григорьев
I integrate your last example with my cellular automata and have some results 
my approach 100 fps no fbo switching 2 cameras.
your approach 70 fps with fbo switching 1 camera.
maybe switching fbo is very costly to OGL state mashine?
Roman


-Original Message-
From: osg-users-bounces @lists.openscenegraph.org [mailto:[EMAIL PROTECTED] On 
Behalf Of J.P. Delport
Sent: Wednesday, May 21, 2008 1:29 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] FBO Rendering

Hi,

please use the latest example.

The first one I sent has some problems: it makes mistakes in reading 
some input texture values because the textures are bound as input and 
output. Multiple runs of the example gave multiple results, but the 
results should be the same every time. The latest example gives the same 
results every time.

jp

Роман Григорьев wrote:
 Thanx JP. Sorry for my mistake (forget about texture coordinates in fragment 
 shader that differ from texture rectangle to texture2D) but all your example 
 works fine and have same framerate 1000 fps.
 I try to modify my example to see my framerates to choose method of rendering.
 Thanx 
 Bye
 Roman
  
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
 Sent: Wednesday, May 21, 2008 12:28 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering
 
 Hi, 
 
 attached is the new version of the example. I think this should work fine 
 with Texture2D as well. No MRT is used, only two FBO's that are switched 
 between frames.
 
 Hope this helps.
 
 regards
 jp
 
 J.P. Delport wrote:
 Hi,

 I think my example does not use FBO in the correct way. It does not 
 seem to be good to attach textures as both input and output. For 
 example in my demo the output is not always the same.

 I have made a new example that uses two cameras with switches above 
 them to do ping-pong and this works much better. I get the same 
 results every time.

 See here for good explanation of ping-pong:
 http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html#fe
 edback2


 The new example uses the first method described here:
 Use one FBO with one attachment per texture that is rendered to, and 
 bind a different FBO in each rendering pass.

 I will send this soon. Just cleaning it up.

 jp

 Роман Григорьев wrote:
 Hi!
 Today I tried to adapt you example to texture2D as input textures and 
 rendertargets but no luck. With texture2Drect works fine but with 
 texture2d it doesn’t work at all. I use 8600GT under vista with 174 
 drivers(osg svn) Roman
  

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 Delport
 Sent: Tuesday, May 20, 2008 5:29 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering

 Hi Roman,

 attached is an example I made that uses ping-pong rendering. It tries 
 to simulate the game of life, see e.g.

 http://en.wikipedia.org/wiki/Conway's_Game_of_Life

 Each iteration depends on the previous one.

 I hope the code makes sense. At least the output looks pretty :)

 regards
 jp

 Роман Григорьев wrote:
 Sorry guys for my f**king outlook
 Here is shaders and source u can take from 1-st message Roman


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 Delport
 Sent: Tuesday, May 20, 2008 2:17 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering

 Hi,

 sorry, I cannot read the attachments in your mail. I will try to make 
 a simple ping-pong example instead.

 jp

 Roman Grigoriev wrote:
 Here is my shaders. It's shaders from my current version that do not 
 use MRT. Source code you can take from my previous messageÎÅÉIf you 
 want to have my setup with FBO MRT just email me. 
 ÎÅÉÎÅÉÎÅÉÎÅÉ-Original Message-ÎÅÉFrom: 
 [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 J.P. DelportÎÅÉSent: Tuesday, May 20, 2008 1:46 PMÎÅÉTo: 
 OpenSceneGraph UsersÎÅÉSubject: Re: [osg-users] FBO 
 RenderingÎÅÉÎÅÉHi,ÎÅÉÎÅÉòÏÍÁÎ çÒÉÇÏÒØÅ× wrote:ÎÅÉ Hi I try to 
 implement cellular automata clouds on OSG and have some problemÎÅÉ 
 ÎÅÉ 1) I can't use (or don't know)  ping-pong rendering technique 
 as ÎÅÉ described here 
 http://www.m3xbox.com/GPU_blog/?m=200712ÎÅÉ ÎÅÉ Because when I 
 attach 2 textures to camera FBO in rendering loop camera ÎÅÉ 
 render to 2 FBO but I need to change dynamically which draw buffer I 
 ÎÅÉ need to draw/ ÎÅÉÎÅÉCan you not also pass the draw buffer as 
 a uniform to the shader and ÎÅÉthen use that in glFragData[buffer] 
 call? This can select which of two ÎÅÉtextures to render 
 to.ÎÅÉÎÅÉ I've red about RenderStage but how to control it is 
 ÎÅÉ unclear for me. I've make a workaround that create another 
 camera that ÎÅÉ render FBO texture to another FBO texture that can 
 I attach in 1 stage ÎÅÉ to calculate cellular automata.ÎÅÉÎÅÉIf 
 you have the same shader code for both cameras, I think you can get 
 ÎÅÉaway with only a single camera and multiple

[osg-users] FBO Rendering

2008-05-20 Thread Роман Григорьев
Hi I try to implement cellular automata clouds on OSG and have some problem

1) I can’t use (or don’t know)  ping-pong rendering technique as described here 
http://www.m3xbox.com/GPU_blog/?m=200712

Because when I attach 2 textures to camera FBO in rendering loop camera render 
to 2 FBO but I need to change dynamically which draw buffer I need to draw/ 
I’ve red about RenderStage but how to control it is unclear for me. I’ve make a 
workaround that create another camera that render FBO texture to another FBO 
texture that can I attach in 1 stage to calculate cellular automata. 

2) I’d like to do RTT rendering not in every frame. But As I understand OSG 
create rendercashe to strore rendering order how can I dynamically attach and 
remove camera from rendering order?  

See my example. If anyone is interested in my program I can share. 

Thanx in advance 

Roman

/* OpenSceneGraph example, osgmultiplerendertargets.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the Software), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

#include osg/GLExtensions
#include osg/Node
#include osg/Geometry
#include osg/Notify
#include osg/MatrixTransform
#include osg/Texture2D
#include osg/TextureRectangle
#include osg/ColorMask
#include osg/Material
#include osg/ClampColor
#include osgDB/ReadFile
#include osgDB/FileUtils

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator

#include osgViewer/Viewer

#include iostream
float random(float min,float max) { return min + 
(max-min)*(float)rand()/(float)RAND_MAX; }

osgViewer::Viewer viewer;
osg::ref_ptrosg::Texture2D LTexture0 = new osg::Texture2D;
osg::ref_ptrosg::Texture2D LTexture1 = new osg::Texture2D;
osg::ref_ptrosg::Texture2D LTexture2 = new osg::Texture2D;
osg::ref_ptrosg::Texture2D LTexture3 = new osg::Texture2D;
osg::Texture2D* noise_tex= new osg::Texture2D;
osg::Texture2D* elipsoid_tex= new osg::Texture2D;
osg::ref_ptrosg::Camera cellCamera = new osg::Camera;
osg::ref_ptrosg::Camera cellCamera1 = new osg::Camera;
osg::ref_ptrosg::Camera cellCamera2 = new osg::Camera;
osg::ref_ptrosg::Camera finalCamera = new osg::Camera;

static bool seq = true;
osg::Uniform* inputtex = new osg::Uniform(inputtex,0);
osg::Uniform* outputtex = new osg::Uniform(outputtex,1);
osg::Uniform* fNoiseOffsetExtX = new osg::Uniform(fNoiseOffsetExtX,0.02f);
osg::Uniform* fNoiseOffsetExtY = new osg::Uniform(fNoiseOffsetExtY,0.02f);
osg::Uniform* fNoiseOffsetHumX = new osg::Uniform(fNoiseOffsetHumX,0.02f);
osg::Uniform* fNoiseOffsetHumY = new osg::Uniform(fNoiseOffsetHumY,0.02f);
osg::Uniform* fNoiseOffsetActX = new osg::Uniform(fNoiseOffsetActX,0.02f);
osg::Uniform* fNoiseOffsetActY = new osg::Uniform(fNoiseOffsetActY,0.02f);
class UniformVarying : public osg::Uniform::Callback
{
public:
virtual void operator () (osg::Uniform* uniform, osg::NodeVisitor* nv)
{
const osg::FrameStamp* fs = nv-getFrameStamp();
 double simulationTime = fs-getSimulationTime();
if (_firstCall)
{
_firstCall = false;
_startTime = simulationTime;
}

_time = simulationTime-_startTime;

uniform-set(_time);
_startTime = simulationTime;
//  std::cout_timestd::endl;

fNoiseOffsetActX-set(random(0,0.5));
fNoiseOffsetActY-set(random(0,0.5));
fNoiseOffsetHumX-set(random(0,0.5));
fNoiseOffsetHumY-set(random(0,0.5));
fNoiseOffsetExtX-set(random(0,0.5));
fNoiseOffsetExtY-set(random(0,0.5));
osg::ref_ptrosg::StateSet cellstateset1 
=cellCamera-getOrCreateStateSet();
osg::ref_ptrosg::StateSet cellstateset2 
=cellCamera2-getOrCreateStateSet();
osg::ref_ptrosg::StateSet finalstateset1 
=finalCamera-getOrCreateStateSet();

if(seq)
{
inputtex-set(0);
outputtex-set(1);
  //  

Re: [osg-users] FBO Rendering

2008-05-20 Thread Роман Григорьев
Sorry guys for my f**king outlook 
Here is shaders and source u can take from 1-st message
Roman


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
Sent: Tuesday, May 20, 2008 2:17 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] FBO Rendering

Hi,

sorry, I cannot read the attachments in your mail. I will try to make a 
simple ping-pong example instead.

jp

Roman Grigoriev wrote:
 Here is my shaders. It's shaders from my current version that do not use MRT. 
 Source code you can take from my previous messageÎÅÉIf you want to have my 
 setup with FBO MRT just email me. ÎÅÉÎÅÉÎÅÉÎÅÉ-Original 
 Message-ÎÅÉFrom: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 DelportÎÅÉSent: Tuesday, May 20, 2008 1:46 PMÎÅÉTo: OpenSceneGraph 
 UsersÎÅÉSubject: Re: [osg-users] FBO RenderingÎÅÉÎÅÉHi,ÎÅÉÎÅÉòÏÍÁÎ 
 çÒÉÇÏÒØÅ× wrote:ÎÅÉ Hi I try to implement cellular automata clouds on OSG 
 and have some problemÎÅÉ ÎÅÉ 1) I can't use (or don't know)  ping-pong 
 rendering technique as ÎÅÉ described here 
 http://www.m3xbox.com/GPU_blog/?m=200712ÎÅÉ ÎÅÉ Because when I attach 2 
 textures to camera FBO in rendering loop camera ÎÅÉ render to 2 FBO but I 
 need to change dynamically which draw buffer I ÎÅÉ need to draw/ 
 ÎÅÉÎÅÉCan 
 you not also pass the draw buffer as a uniform to the shader and ÎÅÉthen use 
 that in glFragData[buffer] call? This can select which of two ÎÅÉtextures to 
 render to.ÎÅÉÎÅÉ I've red about RenderStage but how to control it is ÎÅÉ 
 unclear for me. I've make a workaround that create another camera that ÎÅÉ 
 render FBO texture to another FBO texture that can I attach in 1 stage ÎÅÉ 
 to calculate cellular automata.ÎÅÉÎÅÉIf you have the same shader code for 
 both cameras, I think you can get ÎÅÉaway with only a single camera and 
 multiple targets.ÎÅÉÎÅÉ ÎÅÉ 2) I'd like to do RTT rendering not in every 
 frame. But As I understand ÎÅÉ OSG create rendercashe to strore rendering 
 order how can I dynamically ÎÅÉ attach and remove camera from rendering 
 order?  ÎÅÉÎÅÉSwitching on and off could be done with Switch node or mask 
 as 
 Robert ÎÅÉsaid. Not sure about switching order dynamically, but I'm still 
 not 
 sure ÎÅÉyou need it.ÎÅÉÎÅÉ ÎÅÉ See my example. If anyone is interested 
 in my program I can share.ÎÅÉÎÅÉIf you could send me a simple version of 
 your shader I can have a look.ÎÅÉÎÅÉjpÎÅÉÎÅÉ ÎÅÉ Thanx in advanceÎÅÉ 
 ÎÅÉ RomanÎÅÉ ÎÅÉ 
 ÎÅÉ 
 ÎÅÉ 
 ÎÅÉ ___ÎÅÉ 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[EMAIL 
 PROTECTED]ÎÅÉhttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.orgÎÅÉ
 
 
 begin 666 cell_fp.glsl
 M#0HO*D9204=-14Y47U-([EMAIL PROTECTED]/+@(.[AZ^#W[[EMAIL PROTECTED]G5N
 M:69OFT@V%MQEC)$($-E;Q?=5X.PT*+R_JX/#RX[EMAIL PROTECTED]
 M;FEF;W)M('-A;7!L97(R1!.;[EMAIL PROTECTED]@\/+@(.[C\.#MZ/?H
 MXN#^^7C[B#NX?KE[. -G5N:69OFT@V%MQEC)$($5L:7!S;VED7W1E
 M#L-@T*=6YI9F]R;2!F;]A=!D=EM93L-@T*+R_QZ_/[EMAIL PROTECTED]SE
 M^7MZ/[EMAIL PROTECTED]@[EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X
 [EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X=%D[#0IU;FEF;W)M
 M(9L;V%T(9.;VES94]F9G-E=$AU;[EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES
 M94]F9G-E=$AU;5D[#0IU;FEF;W)M(9L;V%T(9.;[EMAIL PROTECTED]
 M#0IU;FEF;W)M(9L;V%T(9.;VES94]F9G-E=$%C=%D[#0H-B\O\.#G[.7P
 M^R#QZ^[_(.[AZ^#J[N(-G5N:69OFT@:6YT(9396=M96YT5VED=@[#0IU
 M;FEF;W)M(EN=!F4V5G;65N=$AE:[EMAIL PROTECTED]B\O\.#G[.7P^R#JX/#R
 M^R#NX[EMAIL PROTECTED];FEF;W)M(EN=!F5VED=@[#0IU;FEF;W)M(EN=!F
 M25I9VAT.R -@T*+R_Q[.7YYWH_R#O[B#JX/#RY2#NX[EMAIL PROTECTED](.3K_R#B
 M^_?H\OE[C_(.'KZ.;@Z?CH]2#Q[O'EY.7I( T*=6YI9F]R;2!F;]A= @
 [EMAIL PROTECTED];2!F;]A= @[EMAIL PROTECTED]
 M;2!F;]A= @9D]F9G-E=%HQ.PT*=6YI9F]R;2!F;]A= @9D]F9G-E=%HR
 M.PT*#0IF;]A= [EMAIL PROTECTED]/=AEE-E9VUE;[EMAIL PROTECTED]
 M;G1);F1E%]L;V-A;[EMAIL PROTECTED],B!V3]C86Q55E]L;V-A;D-GL-G9E8S(@
 M=DQO8V%L55X.PT*=F5C,B!T96UP.PT*#0II9B H*9!8W1396=M96YT26YD
 M97A?;]C86P\,D@)[EMAIL PROTECTED]9!8W1396=M96YT26YD97A?;]C86P^,S$I*2 -
 M@E[#0H)F5T=7)N(# N,#L-@E]0T*96QS90T*7L-@EV3[EMAIL PROTECTED]
 M#UV3]C86Q55E]L;V-A;YX*VUO9AF06-T4V5G;65N=$EN95X7VQO8V%L
 M+#0N,DJ9E-E9VUE;G17:61T:]F5VED=@[#0H)=DQO8V%L55X+GD]=DQO
 M8V%L559?;]C86PN2MF;]OBAF06-T4V5G;65N=$EN95X7VQO8V%L+S0I
 

Re: [osg-users] FBO Rendering

2008-05-20 Thread Роман Григорьев
Thanx 
Now I try to use integer textures and bitwise operation for cellular automata I 
think this reduce texture memory for textures but this trick only work on G80.
Roman 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
Sent: Tuesday, May 20, 2008 5:29 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] FBO Rendering

Hi Roman,

attached is an example I made that uses ping-pong rendering. It tries to 
simulate the game of life, see e.g.

http://en.wikipedia.org/wiki/Conway's_Game_of_Life

Each iteration depends on the previous one.

I hope the code makes sense. At least the output looks pretty :)

regards
jp

Роман Григорьев wrote:
 Sorry guys for my f**king outlook
 Here is shaders and source u can take from 1-st message Roman
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J.P. Delport
 Sent: Tuesday, May 20, 2008 2:17 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] FBO Rendering
 
 Hi,
 
 sorry, I cannot read the attachments in your mail. I will try to make a 
 simple ping-pong example instead.
 
 jp
 
 Roman Grigoriev wrote:
 Here is my shaders. It's shaders from my current version that do not use 
 MRT. 
 Source code you can take from my previous messageÎÅÉIf you want to have my 
 setup with FBO MRT just email me. ÎÅÉÎÅÉÎÅÉÎÅÉ-Original 
 Message-ÎÅÉFrom: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of J.P. 
 DelportÎÅÉSent: Tuesday, May 20, 2008 1:46 PMÎÅÉTo: OpenSceneGraph 
 UsersÎÅÉSubject: Re: [osg-users] FBO RenderingÎÅÉÎÅÉHi,ÎÅÉÎÅÉòÏÍÁÎ 
 çÒÉÇÏÒØÅ× wrote:ÎÅÉ Hi I try to implement cellular automata clouds on OSG 
 and have some problemÎÅÉ ÎÅÉ 1) I can't use (or don't know)  ping-pong 
 rendering technique as ÎÅÉ described here 
 http://www.m3xbox.com/GPU_blog/?m=200712ÎÅÉ ÎÅÉ Because when I attach 2 
 textures to camera FBO in rendering loop camera ÎÅÉ render to 2 FBO but I 
 need to change dynamically which draw buffer I ÎÅÉ need to draw/ 
 ÎÅÉÎÅÉCan 
 you not also pass the draw buffer as a uniform to the shader and ÎÅÉthen 
 use 
 that in glFragData[buffer] call? This can select which of two ÎÅÉtextures 
 to 
 render to.ÎÅÉÎÅÉ I've red about RenderStage but how to control it is 
 ÎÅÉ 
 unclear for me. I've make a workaround that create another camera that ÎÅÉ 
 render FBO texture to another FBO texture that can I attach in 1 stage ÎÅÉ 
 to calculate cellular automata.ÎÅÉÎÅÉIf you have the same shader code for 
 both cameras, I think you can get ÎÅÉaway with only a single camera and 
 multiple targets.ÎÅÉÎÅÉ ÎÅÉ 2) I'd like to do RTT rendering not in 
 every 
 frame. But As I understand ÎÅÉ OSG create rendercashe to strore rendering 
 order how can I dynamically ÎÅÉ attach and remove camera from rendering 
 order?  ÎÅÉÎÅÉSwitching on and off could be done with Switch node or mask 
 as 
 Robert ÎÅÉsaid. Not sure about switching order dynamically, but I'm still 
 not 
 sure ÎÅÉyou need it.ÎÅÉÎÅÉ ÎÅÉ See my example. If anyone is interested 
 in my program I can share.ÎÅÉÎÅÉIf you could send me a simple version of 
 your shader I can have a look.ÎÅÉÎÅÉjpÎÅÉÎÅÉ ÎÅÉ Thanx in 
 advanceÎÅÉ 
 ÎÅÉ RomanÎÅÉ ÎÅÉ 
 ÎÅÉ 
 ÎÅÉ
  
 ÎÅÉ ___ÎÅÉ 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[EMAIL 
 PROTECTED]ÎÅÉhttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.orgÎÅÉ


 begin 666 cell_fp.glsl
 M#0HO*D9204=-14Y47U-([EMAIL PROTECTED]/+@(.[AZ^#W[[EMAIL PROTECTED]G5N
 M:69OFT@V%MQEC)$($-E;Q?=5X.PT*+R_JX/#RX[EMAIL PROTECTED]
 M;FEF;W)M('-A;7!L97(R1!.;[EMAIL PROTECTED]@\/+@(.[C\.#MZ/?H
 MXN#^^7C[B#NX?KE[. -G5N:69OFT@V%MQEC)$($5L:7!S;VED7W1E
 M#L-@T*=6YI9F]R;2!F;]A=!D=EM93L-@T*+R_QZ_/[EMAIL PROTECTED]SE
 M^7MZ/[EMAIL PROTECTED]@[EMAIL 
 PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X
 [EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES94]F9G-E=$5X=%D[#0IU;FEF;W)M
 M(9L;V%T(9.;VES94]F9G-E=$AU;[EMAIL PROTECTED];FEF;W)M(9L;V%T(9.;VES
 M94]F9G-E=$AU;5D[#0IU;FEF;W)M(9L;V%T(9.;[EMAIL PROTECTED]
 M#0IU;FEF;W)M(9L;V%T(9.;VES94]F9G-E=$%C=%D[#0H-B\O\.#G[.7P
 M^R#QZ^[_(.[AZ^#J[N(-G5N:69OFT@:6YT(9396=M96YT5VED=@[#0IU
 M;FEF;W)M(EN=!F4V5G;65N=$AE:[EMAIL PROTECTED]B\O\.#G[.7P^R#JX/#R
 M^R#NX[EMAIL PROTECTED];FEF;W)M(EN=!F5VED=@[#0IU;FEF;W)M(EN=!F
 M25I9VAT.R -@T*+R_Q[.7YYWH_R#O[B#JX/#RY2