Re: [osg-users] OpenThreads/Atomic currently broken with Xcode 4.3.1 and IOS

2012-03-23 Thread Mathias Fröhlich

Hi,

On Thursday 22 March 2012, Ulrich Hertlein wrote:
 Simpler maybe, but I would expect that to be more expensive in CPU terms
 than a CPU opcode.  Not?
Depends on how this is implemented on BSD.
May be they implement that today in the header with the exact same gcc/clang 
intrinsics? Then it should not matter.
May be its a real library call, then it's probably more expensive.

Greetings

Mathias

-- 
Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
-- 
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Michael Heinrichs, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

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


[osg-users] osgShadow PSSM

2012-03-23 Thread Daniel Schmid
Hi there

Obviously PSSM is good for huge scenes (my case), but the wrong choice for 
multi threaded rendering. Is there a attempt to make PSSM multithreaded, does 
anybody have modified it, or what would be the way to go ?

Regards
Daniel


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


Re: [osg-users] osgShadow PSSM

2012-03-23 Thread Wang Rui
Hi Daniel,

Currently I'm working on the ViewDependentShadowMap and has already added
an initial implementation of PSSM and VSM. I'm using it with my digital
city project which must have huge scenes and multi-threaded rendering
features. I'd like to submit the changes some time later. :-)

Wang Rui


2012/3/23 Daniel Schmid daniel.sch...@swiss-simtec.ch

  Hi there

 ** **

 Obviously PSSM is good for huge scenes (my case), but the wrong choice for
 multi threaded rendering. Is there a attempt to make PSSM multithreaded,
 does anybody have modified it, or what would be the way to go ?

 ** **

 Regards

 Daniel

 ** **

 ** **

 ___
 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] osgShadow PSSM

2012-03-23 Thread Daniel Schmid
So you are mixing PSSM and VSM? Sounds interesting. If you have any sample code 
I could have a look at, I would appreciate...

Von: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] Im Auftrag von Wang Rui
Gesendet: Freitag, 23. März 2012 09:29
An: OpenSceneGraph Users
Betreff: Re: [osg-users] osgShadow PSSM

Hi Daniel,

Currently I'm working on the ViewDependentShadowMap and has already added an 
initial implementation of PSSM and VSM. I'm using it with my digital city 
project which must have huge scenes and multi-threaded rendering features. I'd 
like to submit the changes some time later. :-)

Wang Rui

2012/3/23 Daniel Schmid 
daniel.sch...@swiss-simtec.chmailto:daniel.sch...@swiss-simtec.ch
Hi there

Obviously PSSM is good for huge scenes (my case), but the wrong choice for 
multi threaded rendering. Is there a attempt to make PSSM multithreaded, does 
anybody have modified it, or what would be the way to go ?

Regards
Daniel



___
osg-users mailing list
osg-users@lists.openscenegraph.orgmailto: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] osgShadow PSSM

2012-03-23 Thread Wang Rui
I would submit the code this weekend and everyone can have a look at it and
make changes to make it better (at present I'm still not satisfied with my
own implementation).

Wang Rui

2012/3/23 Daniel Schmid daniel.sch...@swiss-simtec.ch

  So you are mixing PSSM and VSM? Sounds interesting. If you have any
 sample code I could have a look at, I would appreciate…

 **

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


Re: [osg-users] osgShadow PSSM

2012-03-23 Thread Daniel Schmid
Looking forward! Thanks!

Von: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] Im Auftrag von Wang Rui
Gesendet: Freitag, 23. März 2012 09:41
An: OpenSceneGraph Users
Betreff: Re: [osg-users] osgShadow PSSM

I would submit the code this weekend and everyone can have a look at it and 
make changes to make it better (at present I'm still not satisfied with my own 
implementation).

Wang Rui
2012/3/23 Daniel Schmid 
daniel.sch...@swiss-simtec.chmailto:daniel.sch...@swiss-simtec.ch
So you are mixing PSSM and VSM? Sounds interesting. If you have any sample code 
I could have a look at, I would appreciate...

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


Re: [osg-users] Creating an 'outline' effect in osgText?

2012-03-23 Thread Robert Osfield
Hi Preet,

On 23 March 2012 03:28, Preet prismatic.proj...@gmail.com wrote:
 I have a general follow up question about osgText. I'd like to draw
 the text along a path. I thought a good way to do this would have been
 to rotate the text character by character. So I'd create an osgText
 object for each character of text, and position/align them along the
 path... but this doesn't seem to preserve spacing between characters
 (this is expected, but I don't really know how to get around it), and
 the space character itself ( ) as an individual osgText object seems
 to have a width of zero (calculated with osg::Drawable::getBound()).

osgText currently only supports positioning of text along a straight
line.  There is an experimental TextNode replacement for osgText the
is written to allow one to customize the placement of each individual
glyph so this would probably be the best bet for you to look at.  Have
a look for Jeremy Moles TextNode submission in the osg-submissions
archive.

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


Re: [osg-users] A crash problem while using SharedStateManager in the DatabasePager

2012-03-23 Thread Robert Osfield
Hi Rui,

I haven't looked at the relevant code yet, but a DatabaseRequest with
a NULL _loadedModel sounds odd, I wouldn't have thought such a request
would make it into the merge list.  Just checking the
_loadedModel.valid() will be sufficient as long as the DatabaseRequest
isn't being concurrently accessed at the time.

Robert.

On 23 March 2012 02:34, Wang Rui wangra...@gmail.com wrote:
 Hi Robert and all,

 I've encountered a crash problem while managing and rendering huge scene in
 OSG. To make it work smoothly, I use both the IncrementalCompileOperation
 and SharedStateSetManager to help improve the paging process. Both my
 application soon crashes when the camera is moving over the scene quickly
 (which means the scene data is also quickly and frequently loaded and
 unloaded). I debug into it and surprisingly find that the
 databaseRequest-_loadedModel is sometimes empty in
 the DatabasePager::addLoadedDataToSceneGraph() and thus causes the issue. I
 add a determination before using the SharedStateManager to optimize the
 model and the problem seems disappeared:

 if (osgDB::Registry::instance()-getSharedStateManager()
  databaseRequest-_loadedModel.valid())

 osgDB::Registry::instance()-getSharedStateManager()-share(databaseRequest-_loadedModel.get());

 I suggest make such changes in the trunk, too, so we won't meet the same
 crash problem again. But it in fact doesn't find the truth: when and how a
 request in the _dataToMergeList list is changed and the loaded model pointer
 is made invalid? I'm just curious about the reason why the _loadedModel is
 reset unexpectedly. Is there any other possibilities?

 Regards,

 Wang Rui


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

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


Re: [osg-users] Creating an 'outline' effect in osgText?

2012-03-23 Thread Alberto Luaces
Robert Osfield writes:

 Hi Preet,

 On 23 March 2012 03:28, Preet prismatic.proj...@gmail.com wrote:
 I have a general follow up question about osgText. I'd like to draw
 the text along a path. I thought a good way to do this would have been
 to rotate the text character by character. So I'd create an osgText
 object for each character of text, and position/align them along the
 path... but this doesn't seem to preserve spacing between characters
 (this is expected, but I don't really know how to get around it), and
 the space character itself ( ) as an individual osgText object seems
 to have a width of zero (calculated with osg::Drawable::getBound()).

 osgText currently only supports positioning of text along a straight
 line.  There is an experimental TextNode replacement for osgText the
 is written to allow one to customize the placement of each individual
 glyph so this would probably be the best bet for you to look at.  Have
 a look for Jeremy Moles TextNode submission in the osg-submissions
 archive.

If it helps, it is called osgPango (http://code.google.com/p/osgpango/).

-- 
Alberto

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


[osg-users] osgShadow PSSM light source issue

2012-03-23 Thread Daniel Schmid
I have an issue with PSSM. The light source in my scene is not taken into 
account properly (sun). It calculates shadows like if sun as in perfect orbit. 
All other shadow implementations work correctly, and changes in light position 
are calculated correctly, but PSSM is stuck somehow. Does anybody know this 
problem ?

Regards
Daniel


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


Re: [osg-users] Creating an 'outline' effect in osgText?

2012-03-23 Thread Robert Osfield
On 23 March 2012 09:27, Alberto Luaces alua...@udc.es wrote:
 If it helps, it is called osgPango (http://code.google.com/p/osgpango/).

osgPango is not osgText::TextNode I was referring too, rather it's a
separate NodeKit for advance text rendering but come with extra
external depdencies.

The TextNode implementation is something I original route the basics
for, then Jeremy enhanced it to complete far more of it's
functionality.

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 + threading.

2012-03-23 Thread Aitor Ardanza
Hi,

I'm following this example: 
http://doc-snapshot.qt-project.org/4.8/demos-glhypnotizer-main-cpp.html
but I fail to refresh the window... is blank.

This is my code on glPainter:

Code:

GLPainter::GLPainter(ViewerQT *widget)
 : glWidget(widget)
 , doRendering(true)
 {
 }

 void GLPainter::start()
 {
 glWidget-AdapterWidget::makeCurrent();
 QTimer timer;
 connect(timer, SIGNAL(timeout()), glWidget, SLOT(updateGL()));
 timer.start(10);
 startTimer(20);
 }

 void GLPainter::stop()
 {
 QMutexLocker locker(mutex);
 doRendering = false;
 }

 void GLPainter::resizeViewport(const QSize size)
 {
 QMutexLocker locker(mutex);
 viewportWidth = size.width();
 viewportHeight = size.height();

 }

 void GLPainter::timerEvent(QTimerEvent *event)
 {
 QMutexLocker locker(mutex);
 if (!doRendering) {
 killTimer(event-timerId());
 QThread::currentThread()-quit();
 return;
 }
// glWidget-updateFrame();
 }




I initialize the GLWidget like the example and the thread go well but when I 
call glWidget-frame() dont refresh the osg and if I put a connection between 
timer and updateGL() fails to call paintGL().

What am I doing wrong?

Thank you!

Cheers,
Aitor

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





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


[osg-users] osgShadow culling faces

2012-03-23 Thread Daniel Schmid
Hi there

I have some objects whose shadow looks ugly when the front faces are culled. 
For those objects, I would like to have front and back faces taken into account 
for shadow rendering, for others I can go with backfaces. Unfortunately, the 
face fulling is a property of the camera. How can I handle it on a per node 
basis ?

Regards
Daniel


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


Re: [osg-users] osgShadow culling faces

2012-03-23 Thread Sergey Polischuk
Hi, Danielyou can set correct osg::CullFace attribute to stateset of graph branches where you need it Cheers, Sergey23.03.2012, 17:10, "Daniel Schmid" daniel.sch...@swiss-simtec.ch:Hi there I have some objects whose shadow looks ugly when the front faces are culled. For those objects, I would like to have front and back faces taken into account for shadow rendering, for others I can go with backfaces. Unfortunately, the face fulling is a property of the camera. How can I handle it on a per node basis ? RegardsDaniel  ___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] 2nd Camera - disable CameraManipulator

2012-03-23 Thread Paul Griffiths
Hi,

Thanks chris.

the needed lines was:

Code:
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);




The problem for some reason is I cant move the camera. 
which I can't understand.

Heres a class to create my portal, (quite a handy class if you need one?)

Code:

class Portal
{
public:
Portal()
{
// create objects
subgraph = new osg::Group();
trans = new osg::MatrixTransform();
node = new osg::Group;
}

~Portal() {}

void SetSize(float width, float height)
{
// set bounding box size
bb.xMin() = -width / 2;
bb.xMax() = width / 2;

bb.yMin() = 0;
bb.yMax() = 0;

bb.zMin() = -height / 2;
bb.zMax() = height / 2;
}

void SetMatrix(osg::Matrix mat)
{
// set matrix
trans-setMatrix(mat);
}

void SetSubGraph(osg::Group* subgraph)
{
// setsubgraph
this-subgraph = subgraph;
}

osg::MatrixTransform* create(const osg::Vec4 clearColour)
{   
trans-addChild(node);

// create texture
unsigned int tex_width = 800;
unsigned int tex_height = 600;

float portalWidth = bb.xMax()- bb.xMin();
float portalHeight = bb.zMax()- bb.zMin();

ratio = (600. / 800.) / (portalHeight / portalWidth);

texture = new osg::Texture2D;
texture-setTextureSize(tex_width, tex_height);
texture-setInternalFormat(GL_RGB);

texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);

texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

// set up the render to texture camera.
{
camera = new osg::Camera;

// set clear the color and depth buffer
camera-setClearColor(clearColour);

camera-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setProjectionMatrix(osg::Matrixd::identity());
camera-setViewMatrix(osg::Matrixd::identity());

// set viewport
camera-setViewport(0,0,tex_width,tex_height);

camera-setAllowEventFocus(false);

// set camera lookat (NOT WORKING)
camera-setViewMatrixAsLookAt( osg::Vec3( 0., -200., 0. 
), osg::Vec3( 0., 0., 0. ), osg::Vec3( 0., 0., 1. ));

// set the camera to render before the main camera.
camera-setRenderOrder(osg::Camera::PRE_RENDER);

// tell the camera to use OpenGL frame buffer object 
where supported.

camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

// attach the texture and use it as the color buffer.
camera-attach(osg::Camera::COLOR_BUFFER, texture);

// add subgraph to render
camera-addChild(subgraph);

// add camera
node-addChild(camera);
}

{
// left hand side of bounding box.
osg::Vec3 top_left(bb.xMin(),bb.yMin(),bb.zMax());
osg::Vec3 bottom_left(bb.xMin(),bb.yMin(),bb.zMin());
osg::Vec3 bottom_right(bb.xMax(),bb.yMax(),bb.zMin());
osg::Vec3 top_right(bb.xMax(),bb.yMax(),bb.zMax());

// create the geometry for the wall.
geom = new osg::Geometry;

// create vertices
osg::Vec3Array* vertices = new osg::Vec3Array(4);
(*vertices)[0] = top_left;
(*vertices)[1] = bottom_left;
(*vertices)[2] = bottom_right;
(*vertices)[3] = top_right;
geom-setVertexArray(vertices);

// create texchoords
osg::Vec2Array* texcoords = new osg::Vec2Array(4);
(*texcoords)[0].set((1 - ratio) / 2,1.0f);
(*texcoords)[1].set((1 - ratio) / 2,0.0f);
(*texcoords)[2].set(1 - ((1 - ratio) / 2),0.0f);
(*texcoords)[3].set(1 - ((1 - ratio) / 2),1.0f);
geom-setTexCoordArray(0,texcoords);

// create normals
osg::Vec3Array* normals = new osg::Vec3Array(1);

[osg-users] General multithreading question

2012-03-23 Thread Joel Graff
Hi,

Out of curiosity, is OSG's performance sensitive to accesses to threads spawned 
by it's process?  What I mean is, my application runs with an extra thread 
that, functionally does nothing.  At runtime, the application's update 
traversal time is stable at 0.09.  But, if I access that thread *once* (a 
vector gets updated, but it has no effect on the code in the run() function), 
my update traversal time gets erratic and varies from 0.20 to 0.60...

The function that gets called locks a mutex and changes the value of a 
variable, but again, the variable isn't even accessed or used by the other 
thread.  I suspect it has something to do with the call to 
OpenThreads::ScopedLock...

Anyway, the performance hit is pretty minor overall, but it concerns me.

Thanks,

Joel

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





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