[osg-users] Wait for camera to finish rendering

2013-06-19 Thread Marko Srebre
Hello,

I am having a compute pipeline (physics simulation) that ends with a camera 
that renders to an image (for further processing on cpu). I'd like the 
Viewer::frame() to exit only after the image has been rendered to, so that 
update traversal happens after the data has been downloaded to image.

I am familiar with the workings of 


Code:
setDataVariance(osg::Object::DYNAMIC), 



but this unfortunately applies to drawables, not the output image. If I set 
data variance to dynamic, the frame() will wait to process the drawables for 
the camera node, but exit right after, not waiting for the render to image to 
finish. The only way I could figure out, to make it wait, is to set up a dummy 
camera (with dynamic variance) with a render order right after my image-camera. 
That works, but I was hoping there is nicer solution to this problem that I am 
missing.

I was also considering camera PostDraw callback, but it doesn't really solve 
the problem, since the downloaded data won't be available in the next frame 
update travesal.

If anyone can share some experience on this matter, I'd appreciate it. Thanks.

Cheers,
Marko

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





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


[osg-users] Include Sub-camera in Near/Far Computation

2012-06-12 Thread Marko Srebre
Hi,

I have the main camera in my viewer and then there is a second (post-render) 
camera attached to the scene root. Both cameras have some geometry each in 
their own subgraph. When the first (main) camera computes near/far it ignores 
the geometry below the second camera. Is there a way to hint the first camera 
to include the geometry from the second camera when computing near/far plane? I 
need this since both cameras share the depth buffer.

Thanks,
Marko

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





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


Re: [osg-users] Post-render Camera Reusing the Depth-buffer

2012-06-12 Thread Marko Srebre
I tried your suggestion and it works. I attached the depth texture to the first 
pass and reused it in the second. I guess the performance of RTT is just about 
the same as rendering to conventional buffer, so this should work pretty good. 
It also gives some more control over the situation. Thank you.

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





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


Re: [osg-users] Post-render Camera Reusing the Depth-buffer

2012-06-11 Thread Marko Srebre
Hello Sebastian,

thanks for a quick reply. I wanted to do something like that, but I am missing 
the "depth_tex" part. The first camera doesn't render to texture, but to a 
classical frame buffer/depth_buffer. The second camera is then RTT, but it 
should be using the depth buffer from the first one.

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





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


[osg-users] Post-render Camera reusing the Depth Buffer

2012-06-11 Thread Marko Srebre
Hello,

I have the following setup. The main camera renders the scene to frame-buffer. 
Attached in the subgraph below the main camera, there is a post-render camera 
which does its work after the main has completed and renders to texture. 
However, in this second camera I want to reuse the depth buffer from the main 
camera.

I have something like:


Code:

osg::Camera* rt = new osg::Camera;
rt->setRenderOrder(osg::Camera::POST_RENDER, 0);
rt->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
rt->attach(osg::Camera::COLOR_BUFFER, tex);
rt->setClearMask(0);




This doesn't seem to work well, when ClearMask is 0; there are weird artifacts 
in rendering. It works fine when depth is cleared, though this is not what I am 
after. I am guessing that I should explicitly attach the depth buffer (that was 
previously used by main camera), but I am not really sure how to do that. If 
anyone has experience with this or ideas where to look, I'd very much 
appreciate it. Thanks.

Cheers,
Marko[/code]

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





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


Re: [osg-users] osgWidget examples dataset

2012-04-16 Thread Marko Srebre
Did you ever use png themes? I am trying to use 66x66 pngs for theming  with 
osgWidget::Frame::createSimpleFrameFromTheme(), but the corners/borders of the 
frame are not displayed correctly. There is a one pixel wide gap at corners of 
the frame. This also happens with stock theme-2.png that's included in the osg 
dataset.

Does anyone know how this should work?

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





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


[osg-users] osgWidget examples dataset

2012-04-13 Thread Marko Srebre
Hi,

I'm not sure if anyone noticed before, but there is a lot of data missing from 
OpenSceneGraph dataset that are required to properly run osgwidget* examples. 
For example, osgwidgetmessagebox uses theme-8-shadow.png and theme-8.png, but 
these assets are nowhere to be found. I've check both 3.0.0 and trunk datasets.

The problem is the examples look horrible without proper themes.  But even 
using theme-2.png as substitute, makes them much prettier. :)

I'd like to ask the author if it is possible to upload the missing files or 
perhaps point me in the direction where to get them? Thanks.

Cheers,
Marko

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





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


[osg-users] OSG, physics serialization

2011-01-11 Thread Marko Srebre
Hello,

I am considering the overall design of how physics engine should be integrated 
with OSG if I wanted to support complete serialization (load/save) of both OSG 
nodes and the physics state. With new dev versions there is serialization 
support for OSG and let us assume we can can somehow dump the physics engine 
state. I am wondering how should it all be implemented. 

One idea I have is, the physics world could be implemented as an OSG node so it 
could be serialized by osg standards as a part of a scene graph. However, I am 
not sure this is a good design, putting something like that into a osg node, 
since it hasn't got anything to do with rendering. Also, this node would have 
rigid bodies and collision shapes which in turn need references to other nodes 
(not necessariliry children) which are used as a graphics representation of 
physics objects in the scene graph for position/attitude updates. So it is all 
interconnected, and such references would need to be restored upon state load.

The other solution would be to keep physics out of the scene graph... that way 
osg serialization support cannot be used for physics state. If physics engine 
had any serialization that could be used, but there would still need to be a 
"register" that knows how to connect appropriate physics bodies to OSG nodes 
after both states have been restored.

I would appreciate any suggestions and ideas, or if anyone has experience to 
share regarding this topic. Thanks.

Cheers,
Marko

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





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


[osg-users] osgLua and osgShadow

2009-09-10 Thread Marko Srebre
Hello,

while loading osgShadow with osgLua (which uses osgIntrospection and 
osgWrappers):

script->enable("osgShadow");

I get a segfault. This happens in 2.8.2 as in trunk. While I didn't properly 
investigate this, I should still mention for those interested that the crash 
can be avoided by suppressing the problematic ConvexPolyhedron object. Add the 
following to src/osgWrappers/genwrapper.conf and rebuild the wrappers:

suppress reflector "osgShadow::ConvexPolyhedron"

I may sure about this, but if this is not osgLua specific, perhaps it could be 
put in trunk until better solution come along.

Best regards, 
Marko



#0  0x7fca5fa385aa in osg::Matrixd::set () from 
/usr/local/lib64/libosg.so.55
#1  0x7fca5fa67c9c in osg::Matrixd::Matrixd () from 
/usr/local/lib64/libosg.so.55
#2  0x7fca57fff04e in 
osgIntrospection::Value::Instance_box::Instance_box ()
   from /usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osg.so 
  
#3  0x7fca57ffe27b in osgIntrospection::Value::Value () from 
/usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osg.so
#4  0x7fca56194ffd in (anonymous namespace)::reflector34::reflector34 ()
  
   from /usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so   
  
#5  0x7fca56199337 in __static_initialization_and_destruction_0 () from 
/usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so
#6  0x7fca56199558 in global constructors keyed to ConvexPolyhedron.cpp ()  
 
   from /usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so   
 
#7  0x7fca56246cc2 in __do_global_ctors_aux () from 
/usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so
#8  0x7fca56066c4b in _init () from 
/usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so   
 
#9  0x7fca55fe65d0 in ?? () from 
/usr/local/lib64/osgPlugins-2.8.2/osgwrapper_osgShadow.so   

#10 0x7fca5ff1d998 in call_init () from /lib64/ld-linux-x86-64.so.2 
 
#11 0x7fca5ff1dac7 in _dl_init_internal () from /lib64/ld-linux-
x86-64.so.2  
#12 0x7fca5ff21cfe in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
 
#13 0x7fca5ff1d626 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2   
 
#14 0x7fca5ff214ab in _dl_open () from /lib64/ld-linux-x86-64.so.2  
 
#15 0x7fca5ad6cf9b in dlopen_doit () from /lib/libdl.so.2   
 
#16 0x7fca5ff1d626 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2   
 
#17 0x7fca5ad6d34c in _dlerror_run () from /lib/libdl.so.2  
 
#18 0x7fca5ad6cf01 in dlopen@@GLIBC_2.2.5 () from /lib/libdl.so.2   
 
#19 0x7fca5bb0c4bb in osgDB::DynamicLibrary::getLibraryHandle () from 
/usr/local/lib64/libosgDB.so.55
#20 0x7fca5bb0c2de in osgDB::DynamicLibrary::loadLibrary () from 
/usr/local/lib64/libosgDB.so.55 
#21 0x7fca5ef1d8d0 in osgLua::loadWrapper () from 
/usr/local/lib64/libosgLua.so  
#22 0x7fca5ef21722 in osgLua::Script::enable () from 
/usr/local/lib64/libosgLua.so   
#23 0x0040cb99 in Script::loadLibrary (this=0x19cb1e0, name=
 
{static npos = 18446744073709551615, _M_dataplus = 
{> = {<__gnu_cxx::new_allocator> = {}, }, _M_p = 0x19d3608 "osgShadow"}}) at 
/home/marko/devel/sword/applications/swordEngine/swordEngine.cpp:17  
#24 0x0040aa42 in main () at 
/home/marko/devel/sword/applications/swordEngine/swordEngine.cpp:125
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Vertex texture fetch in r600+ ATI cards

2008-07-19 Thread Marko Srebre
I realize this is a driver bug and not osg related, still I post this in 
hope this knowledge saves someone's precious time wondering why VTF 
makes things acting very weird.


For courageos ones venturing into ati glsl wonderland, this is what I 
have discovered. The unifrom name of the "baseTexture" from 
osgshaderterrain must be alphabetically before the "terrainTexture", as 
it is by default. So for example renaming the heightmap to 
"aterrainTexture" render the object white, while "cterrainTexture" works 
just fine.


Marko

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


Re: [osg-users] Vertex texture fetch in r600+ ATI cards

2008-07-18 Thread Marko Srebre

This sure was a tough one. It's a weird hack.

To make osgshaderterrain example work on Radeon cards with VTF support, 
you have to add something like this to the vertex shader code:



uniform sampler2D baseTexture;

...

vec4 dummy_lookup = texture2D(baseTexture, texcoord);


Also I get some queer behaviour when using two textures in fragment 
program... ati opengl support seems quite buggy and unpredictable.




Marko wrote:


This is my first post on the lists; hello to everybody and thanks for 
all the precious info I gathered here in one year of working with 
openscenegraph.


I have a RadeonHD 3850 card working fine with fglrx driver (8.6) in Linux.

I have problems running osgshaderterrain example. I get repetitions of 
this error:


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

The cause of warning is texture2d() lookup in vertex shader, if I remove 
this, the error disappears.


ATI/AMD claims vertex texture fetch is supported by all ATI hardware 
since r600 (Radeon HD2xxx), so I though at first it may be a driver 
issue. Googling around I found some posts saying the drivers 8.5 should 
support VTF in GLSL, but that may have been about Windows drivers.


I used the check in osgshaderterrain and queryed 
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS. It returns 16. As I understand this 
means the vertex fetch should be supported. So what could be the 
problem, the texture format? Besides GL_LUMINANCE_FLOAT32_ATI, I tried 
GL_LUMINANCE32F_ARB and GL_RGBA32F_ARB, with no better results.


Is this a driver issue/bug? Has anyone managed to run VTF on ATI cards? 
What about Windows users, it would be helpful to know if 
osgshaderterrain runs there, since the drivers (8.5+) supposedly support 
it.


Any hints on where to look for information are most welcome. Thanks.

Marko
___
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