Re: [osg-users] ViewDependentShadowMap memory leaks with CompositeViewer

2012-12-20 Thread Daniel Schmid
Hi Robert

Sounds like a good idea to use observers. I just did the following:

- Derived my customized ViewDependentShadowMap class also from Observer. 
- override the createViewDependentData method to add this-ptr to CullVisitors 
observers
- implemented Observers objectDeleted method to remove the CullVisitors map 
entry from _viewDependentDataMap.

Now I noticed that the CullVisitors pointer that is passed into objectDeleted 
method does not match any of the CullVisitors that are used for culling, 
therefore the entry in the map is never found and never deleted.

This is strange...

Next I try to store the pointer to the View object and add an observer onto it. 
Maybe I have more luck...

Cheers,
Daniel

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





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


Re: [osg-users] ViewDependentShadowMap memory leaks with CompositeViewer

2012-12-20 Thread Robert Osfield
HI Daniel,

The CullVisitor's no matching is an odd one.  Any chance it's an issue of
virtual inheritance somewhere along the line.  Do you try a dynamic_cast to
CullVistor on the object deleted?

Robert.

On 20 December 2012 08:27, Daniel Schmid daniel.sch...@swiss-simtec.chwrote:

 Hi Robert

 Sounds like a good idea to use observers. I just did the following:

 - Derived my customized ViewDependentShadowMap class also from Observer.
 - override the createViewDependentData method to add this-ptr to
 CullVisitors observers
 - implemented Observers objectDeleted method to remove the CullVisitors
 map entry from _viewDependentDataMap.

 Now I noticed that the CullVisitors pointer that is passed into
 objectDeleted method does not match any of the CullVisitors that are used
 for culling, therefore the entry in the map is never found and never
 deleted.

 This is strange...

 Next I try to store the pointer to the View object and add an observer
 onto it. Maybe I have more luck...

 Cheers,
 Daniel

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





 ___
 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] OSG + QT + Mac focus issue

2012-12-20 Thread Mike Krus
Hi 

I have a bug where, after closing an OSG widget, keyboard events don't get sent 
properly. 

We use Qt4.8.4 and OpenSceneGraph (latest version from SVN). We create several 
qwidgets as tabs widgets, and have the ability to close them (using a kb short 
cut or the close button on the tab). The OSG widget uses osgQt.

When the OSG widget is closed, I no longer get keyboard event anywhere in the 
app even though focus appears to be properly set.

Using the debugger, I see the event is received in QT's code in
- (void)sendEvent:(NSEvent *)event 
in qcocoasharedwindowmethods_mac_p.h 

which then calls 
[super sendEvent:event]; 
but this fails somewhere in Apple's toolkit code and the application beeps (not 
by calling Qt's beep function). 
It would normally end up calling 
- (void)keyDown:(NSEvent *)theEvent 
in qcocoaview_mac.mm 

I tracked down the closing of the OSG widget to see if it was doing anything 
weird, but it all seems fine.

I don't know if the bug is with our code, Qt or OSG but I'm failing to find out 
why this is happening and was wondering if anyone had come across anything like 
that. 


Mike


Mike Krus (PhD) - Principal Software Engineer

Midland Valley Exploration
144 West George Street
Glasgow G2 2HG, UK
Tel: +44 141 332 2681
Fax: +44 141 332 6792

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


[osg-users] How to set mouse position

2012-12-20 Thread michael kapelko
Hi.
Can anyone tell me how to set mouse position in OSG?
I tried to google it up without any success.
Thanks.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to set mouse position

2012-12-20 Thread Robert Osfield
HI Michael,

On 20 December 2012 10:10, michael kapelko korn...@gmail.com wrote:

 Can anyone tell me how to set mouse position in OSG?
 I tried to google it up without any success.


viewer.requestWarpPointer(x,y);

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


Re: [osg-users] OSG + QT + Mac focus issue

2012-12-20 Thread Robert Osfield
Hi Mike,

Unfortunately I don't have an OSX box or much experience with Qt to
contribute to resolving this issue, hopefully others might be able to help,
but the combination of Qt+OSX is likely to be quite niche so it might
something you'll need to spearhead.

As a general comment that might help the process of characterizing the bug,
does the same problem appear on other OS's?  Does it appear on other
versions of Qt?

I do wonder if the newly released Qt5 might have changed things under OSX -
possible for better or worse!

Robert.

On 20 December 2012 09:15, Mike Krus m...@mve.com wrote:

 Hi

 I have a bug where, after closing an OSG widget, keyboard events don't get
 sent properly.

 We use Qt4.8.4 and OpenSceneGraph (latest version from SVN). We create
 several qwidgets as tabs widgets, and have the ability to close them (using
 a kb short cut or the close button on the tab). The OSG widget uses osgQt.

 When the OSG widget is closed, I no longer get keyboard event anywhere in
 the app even though focus appears to be properly set.

 Using the debugger, I see the event is received in QT's code in
 - (void)sendEvent:(NSEvent *)event
 in qcocoasharedwindowmethods_mac_p.h

 which then calls
 [super sendEvent:event];
 but this fails somewhere in Apple's toolkit code and the application beeps
 (not by calling Qt's beep function).
 It would normally end up calling
 - (void)keyDown:(NSEvent *)theEvent
 in qcocoaview_mac.mm

 I tracked down the closing of the OSG widget to see if it was doing
 anything weird, but it all seems fine.

 I don't know if the bug is with our code, Qt or OSG but I'm failing to
 find out why this is happening and was wondering if anyone had come across
 anything like that.


 Mike

 
 Mike Krus (PhD) - Principal Software Engineer

 Midland Valley Exploration
 144 West George Street
 Glasgow G2 2HG, UK
 Tel: +44 141 332 2681
 Fax: +44 141 332 6792

 ___
 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] Model Matrix in Vertex Shader

2012-12-20 Thread Christian Buchner
Is there one definitive list that explains all the built-in osg uniforms?
This one would have come handy earlier, but I did not know about it.

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


Re: [osg-users] ViewDependentShadowMap memory leaks with CompositeViewer

2012-12-20 Thread Daniel Schmid
Hi Robert

I tried with dynamic_cast and also with reinterpret_cast. Both didn't give me 
the correct pointer. Could it be that with multiple inheriance it is not 
working correctly? CullVisitor is derived from NodeVisitor AND CullStack...

Finally I created my own map of the following type:
typedef std::maposgUtil::CullVisitor*, osg::Camera*  ViewMapType;

I added the observer to the camera. So as soon as a camera is deleted (view 
removed), I get notified. Then I iterate through the list above to find out 
which CullVisitors are related to the camera (can be multiple). Finally I 
remove these cullvisitors entries from _viewDependentDataMap.

Maybe not the most beautifull solution, but this way I was succesfull.

Thank you!

Cheers,
Daniel

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





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


Re: [osg-users] Model Matrix in Vertex Shader

2012-12-20 Thread Alberto Luaces
Christian Buchner writes:

 Is there one definitive list that explains all the built-in osg
 uniforms? This one would have come handy earlier, but I did not know
 about it.

Take a look at Mike Weiblen's GLSL cheatsheet, although it could be
outdated:

http://mew.cx/glsl_quickref.pdf

-- 
Alberto

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


[osg-users] multiple POST RENDER cameras

2012-12-20 Thread DavidHornung

Hello,

i looked for HUD and how to implement them. I also want to play a video 
behind the 3D scene which could also be done with POST RENDER.


Is is it possible to  play Video as background image (like described in 
the two available OSG books)

then post render the 3D Scene with POST_RENDER
and after that render the semi-transaprent HUD (with texts etc) 
POST_RENDER ?


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


Re: [osg-users] multiple POST RENDER cameras

2012-12-20 Thread Robert Osfield
Hi David,

You can have as many pre, nested or post Camera as you wish and can very
the number and type on each frame.

Robert.

On 20 December 2012 13:41, DavidHornung horn...@googlemail.com wrote:

 Hello,

 i looked for HUD and how to implement them. I also want to play a video
 behind the 3D scene which could also be done with POST RENDER.

 Is is it possible to  play Video as background image (like described in
 the two available OSG books)
 then post render the 3D Scene with POST_RENDER
 and after that render the semi-transaprent HUD (with texts etc)
 POST_RENDER ?

 Cheers,
 David
 __**_
 osg-users mailing list
 osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.**org/listinfo.cgi/osg-users-**
 openscenegraph.orghttp://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] [osgPlugins] DDS Texture vanish with LINEAR_MIPMAP_LINEAR

2012-12-20 Thread Lukasz Izdebski
Hi,
i probably have solution for this problem, i have found a bug in dds plugin
ReaderWriterDDS.cpp
Line 633
unsigned numMipmaps = osg::Image::computeNumberOfMipmapLevels( s, t, r );

when compute numMipmaps returns wrong number. this number is less then number 
of mipmaps in dds file( ddsd.dwMipMapCount ) . This bug makes that when dds 
mipmaps are loaded to opengl last mipmap (4x4) isn't loaded. and with 
combination with LINEAR_MIPMAP_LINEAR make this bug.


the numMipmaps should be taken form ddsd.dwMipMapCount


in attachment i send a corrected version of file.
... 

Thank you!

Cheers,
Lukasz

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




Attachments: 
http://forum.openscenegraph.org//files/readerwriterdds_204.cpp


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


Re: [osg-users] Model Matrix in Vertex Shader

2012-12-20 Thread Sergey Polischuk
Hi Not sure if it is still true, but last time i used this stuff with stereo setups (not sure but it can hold for any offset-based slave cameras setup) osg_ViewMatrix and it's inverse was containing main camera view (and inverse) matrix and was same for both eyes. Cheers,Sergey. 20.12.2012, 00:12, "Glenn Waldron" gwald...@gmail.com:vec4 worldVert = osg_ViewMatrixInverse * gl_ModelViewMatrix * gl_Vertex; ...where osg_ViewMatrixInverse is a built-in OSG uniform (type mat4). Just be aware: GLSL is single-precision, so you will lose some precision doing this.Glenn Waldron / @glennwaldronOn Wed, Dec 19, 2012 at 3:03 PM, Ethan Fahy ethanf...@gmail.com wrote:Hello all,  I would like to have access to vertex world coordinates in my GLSL vertex shader that is attached to an osg::Node.  In GLSL the Model Matrix and the View Matrix are combined into the ModelViewMatrix, so you cannot get access to the Model Matrix without either passing in the Model Matrix itself or the Inverse View Matrix (which could be multiplied by the ModelViewMatrix to get the Model Matrix).  I am familiar with how to attach an osg::Uniform to pass uniforms into the shader; my question is, what is the best way to obtain either the Model Matrix or the Inverse View Matrix from a given osg::Node?  I think I may be able to use osg::getLocalToWorld() to obtain the Model Matrix?  I have read through this thread: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-April/009903.html but it doesn't really arrive at a satisfying conclusion and may or may not be out of date.  Any advice is appreciated.  Thanks,  -Ethan  -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51639#51639  ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Change Camera FBO attachment

2012-12-20 Thread Riccardo Corsi
Hi Robert,

thanks for your suggestion.

The reason I went for a slave camera is that it makes it easier to add the
FBO path at a later point, without touching the scenegraph,
as it inherits the viewer's scene data by default.

Besides inserting the cameras subgraph into the main graph,
do you think it's reasonable to attach the FBO cameras group as the
subgraph of a fake slave camera,
and attach the main scene also as FBO camera child?
I draw a little graph below for clarity.

Thank you,
Ricky


VIEWER
   /  \
MAIN CAM SLAVE_CAM
 |   |
 |   |
 |switch
 |   |
 | / | \
  |/  |  \
 | fbo1 fbo2 fbo3
 | /   /   /
  \   /   /   /
   \ /   /   /
\   /   /   /
 | |  /   /
 | | /   /
  SCENE



On Tue, Dec 18, 2012 at 9:25 PM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Riccardo,

 Setting up the camera's rendering backend on each frame will be
 expensive.  Personally I'd just using multiple RTT Camera each with their
 own FBO and Textures associated with them.  Using a Switch, Sequence or
 NodeMask's you can select which of the Camera you want to render to on each
 frame.

 Robert.

 On 18 December 2012 17:24, Riccardo Corsi riccardo.co...@kairos3d.itwrote:

 Hi All,

 in my application I need an FBO camera to render different frames into
 different textures, because they will be used by an encoder and thus need
 to persist for some time.

 I haven't found an easy way to copy the contents of a texture or of an
 FBO into another texture.
 So during the update traversal I change the camera texture attachment
 with a new texture and call Renderer::SetCameraRequiresSetUp(true).

 Eveything works fine, but I'm wondering if there's a better/cleaner
 approach to achieve the same result, as I don't know whether requesting
 the camera setup every frame has a huge impact on perfomances.

 Thank you,
 Ricky


 ___
 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] Model Matrix in Vertex Shader

2012-12-20 Thread Paul Martz
The OpenSceneGraph Reference Manual at lulu.com also has this info, but both 
resources are out of date.


You can easily get a list of OSG's built-in uniforms by doing a recursive grep 
in your OSG source tree for getOrCreateUniform. All OSG built-in uniforms are 
created using this function.

   -Paul


On 12/20/2012 4:57 AM, Alberto Luaces wrote:

Christian Buchner writes:


Is there one definitive list that explains all the built-in osg
uniforms? This one would have come handy earlier, but I did not know
about it.


Take a look at Mike Weiblen's GLSL cheatsheet, although it could be
outdated:

http://mew.cx/glsl_quickref.pdf


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


Re: [osg-users] Model Matrix in Vertex Shader

2012-12-20 Thread Ethan Fahy
If I insert the line:

vec4 worldVerts = osg_ViewMatrixInverse * gl_ModelViewMatrix * gl_Vertex;

into my vertex shader (without actually using it for anything, just declaring 
it)
I get the following error:

error C1008: undefined variable osg_ViewMatrixInverse

Do I have to pass osg_ViewMatrixInverse as a uniform from the osg side or 
should I be able to use osg_ViewMatrixInverse in any GLSL code attached to an 
osg::Node without any extra effort?

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





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


Re: [osg-users] Model Matrix in Vertex Shader

2012-12-20 Thread Ethan Fahy
Nevermind, I figured out that you have to put the following at the top of the 
vertex shader before being able to use osg_ViewMatrixInverse:

uniform mat4 osg_ViewMatrixInverse;

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





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


[osg-users] Draw shadow map to quad problem.

2012-12-20 Thread Peterakos
Hello.

I have a camera which renders to osg::Camera::DEPTH_BUFFER using
camera-attach(osg::Camera::DEPTH_BUFFER, texture);

Here is how i create the texture:
texture-setInternalFormat(GL_DEPTH_COMPONENT);
texture-setSourceFormat(GL_DEPTH_COMPONENT);
texture-setSourceType(GL_UNSIGNED_BYTE);
texture-setShadowComparison(false);


My Model draws to this texture in fragment shader using : gl_FragDepth
= gl_FragCoord.z;

After that i render this texture to a quad in fragment shader using
uniform sampler2D depth_texture;
void main(){
  float depth = texture2D(depth_texture, gl_TexCoord[0]).r;
  gl_FragColor = vec4(depth, depth, depth , 1.0);
}


The problem is that i get the 2 following errors and i cant figure out
where the problem is caused.
error1: 'texture2D' : no matching overloaded function found (using
implicit conversion)
error2: 'r' : field selection requires structure , vector or matrix on
left hand side.

What do i do wrong ?

Any help would much appreciated.
Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [vpb] osgdem with terrain from worldMachine

2012-12-20 Thread walter perdan
Hi,

i would create a tiled Terrain with osgdem . i have my heightMap and colourMap 
made with WorldMachine a terrain editor http://www.world-machine.com/ . With 
the heightmap i have no problem but with the colour map i got weird artifacts. 
This is my process:

i got the 8 bit .png colour map from WM.
 gdal_tranlsate colourMapDistorted_gdal_tr_16bit_02.png 
colourMapDistorted_gdal_tr_16bit_02.tif
gdaladdo -r average colourMapDistorted_gdal_tr_16bit_02.tif 2 4 8 16 32

then osgdem:

osgdem -t data/colourMapDistorted_gdal_tr_16bit_02.tif -d 
data/icebergHeightMapDistorted02_gdal.tif -l 8 -v 1 -o iceberg.ive -a 
iceberg.osga

i tried with other picture format, WM may output .bmp(8bit) ,png(8bit) 
.tiff(8bit) ,png(16bit) .tiff(16bit). i tired with all format but with no luck. 
The only difference that i noticed is that when i average the .tif(16bit) i got 
an alpha image instead of a RGB image . Who can enlight in the right direction?




Thank you!

Cheers,
walter

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





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


[osg-users] What can I do to improve rendering performance for a bunch of billboarded nodes?

2012-12-20 Thread Preet
I have a scene that contains 100s of small low-complexity flat geometries
(triangles, squares, ngons, etc). Each of them is parented with an
autotransform node so that they constantly face the camera. Color data is
passed through vertex attributes and there's no texture data.

Is there anything I can do to improve rendering performance in this
scenario? This is on a mobile device (OpenGL ES 2) and I get a fair bit of
slow down as the number of objects increases.


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