Re: [osg-users] Draw Instanced

2016-04-15 Thread sam
Would there be a big performance difference between using a TextureBuffer
Object and a UniformBuffer object?

Thanks, Sam

On Fri, Apr 15, 2016 at 1:15 PM, sam  wrote:

> Doh! Thanks, Glenn. Unfortunately I still have some holes in the map but
> its starting to look considerably better. I will definitely looking to
> using a TextureBuffer.
>
> On Fri, Apr 15, 2016 at 12:50 PM, Glenn Waldron 
> wrote:
>
>> Sam,
>> I think you are not calling setNumElements() on your uniform array. You
>> could also do that in the osg::Uniform constructor.
>>
>> Anyway, a uniform array of matrices is going to be limiting in terms of
>> scale and speed -- I'd recommend a buffer object instead. (osgEarth uses an
>> osg::TextureBuffer.)
>>
>>
>> Glenn Waldron
>>
>> On Fri, Apr 15, 2016 at 2:35 PM, sam  wrote:
>>
>>> Hi All,
>>>
>>> I'm having some trouble getting my code to use hardware instancing. I've
>>> referenced OSGEarth, DrawInstanced example, and a few different code
>>> samples on the web. I've gotten pretty close but I seem to be at a bit of
>>> an impasse.
>>>
>>> This screenshot shows what the map looks like with the default rendering:
>>>
>>> http://imgur.com/fKvunfd
>>>
>>> This screenshot shows what the map looks like after I apply my instance
>>> rendering code to it:
>>>
>>> http://imgur.com/zZCzurr
>>>
>>> The map is composed of a lot of little nodes. I figured instanced
>>> rendering would be helpful in this case. The map has ~4000 individual
>>> nodes. Two of the nodes are repeated 465 and 266 times. I have trimmed down
>>> my code and it is posted here:
>>>
>>> http://pastebin.com/ifSVSzD6
>>>
>>> From what it looks like. Its rendering one copy of every nodes but not
>>> anymore that that. I have commented out lines 215 to 224 as it doesn't work
>>> at all. Any insight or help would be greatly appreciated.
>>>
>>> Thanks, Sam
>>>
>>> ___
>>> 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] Draw Instanced

2016-04-15 Thread sam
Doh! Thanks, Glenn. Unfortunately I still have some holes in the map but
its starting to look considerably better. I will definitely looking to
using a TextureBuffer.

On Fri, Apr 15, 2016 at 12:50 PM, Glenn Waldron  wrote:

> Sam,
> I think you are not calling setNumElements() on your uniform array. You
> could also do that in the osg::Uniform constructor.
>
> Anyway, a uniform array of matrices is going to be limiting in terms of
> scale and speed -- I'd recommend a buffer object instead. (osgEarth uses an
> osg::TextureBuffer.)
>
>
> Glenn Waldron
>
> On Fri, Apr 15, 2016 at 2:35 PM, sam  wrote:
>
>> Hi All,
>>
>> I'm having some trouble getting my code to use hardware instancing. I've
>> referenced OSGEarth, DrawInstanced example, and a few different code
>> samples on the web. I've gotten pretty close but I seem to be at a bit of
>> an impasse.
>>
>> This screenshot shows what the map looks like with the default rendering:
>>
>> http://imgur.com/fKvunfd
>>
>> This screenshot shows what the map looks like after I apply my instance
>> rendering code to it:
>>
>> http://imgur.com/zZCzurr
>>
>> The map is composed of a lot of little nodes. I figured instanced
>> rendering would be helpful in this case. The map has ~4000 individual
>> nodes. Two of the nodes are repeated 465 and 266 times. I have trimmed down
>> my code and it is posted here:
>>
>> http://pastebin.com/ifSVSzD6
>>
>> From what it looks like. Its rendering one copy of every nodes but not
>> anymore that that. I have commented out lines 215 to 224 as it doesn't work
>> at all. Any insight or help would be greatly appreciated.
>>
>> Thanks, Sam
>>
>> ___
>> 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] Draw Instanced

2016-04-15 Thread Glenn Waldron
Sam,
I think you are not calling setNumElements() on your uniform array. You
could also do that in the osg::Uniform constructor.

Anyway, a uniform array of matrices is going to be limiting in terms of
scale and speed -- I'd recommend a buffer object instead. (osgEarth uses an
osg::TextureBuffer.)


Glenn Waldron

On Fri, Apr 15, 2016 at 2:35 PM, sam  wrote:

> Hi All,
>
> I'm having some trouble getting my code to use hardware instancing. I've
> referenced OSGEarth, DrawInstanced example, and a few different code
> samples on the web. I've gotten pretty close but I seem to be at a bit of
> an impasse.
>
> This screenshot shows what the map looks like with the default rendering:
>
> http://imgur.com/fKvunfd
>
> This screenshot shows what the map looks like after I apply my instance
> rendering code to it:
>
> http://imgur.com/zZCzurr
>
> The map is composed of a lot of little nodes. I figured instanced
> rendering would be helpful in this case. The map has ~4000 individual
> nodes. Two of the nodes are repeated 465 and 266 times. I have trimmed down
> my code and it is posted here:
>
> http://pastebin.com/ifSVSzD6
>
> From what it looks like. Its rendering one copy of every nodes but not
> anymore that that. I have commented out lines 215 to 224 as it doesn't work
> at all. Any insight or help would be greatly appreciated.
>
> Thanks, Sam
>
> ___
> 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] Draw Instanced

2016-04-15 Thread sam
Hi All,

I'm having some trouble getting my code to use hardware instancing. I've
referenced OSGEarth, DrawInstanced example, and a few different code
samples on the web. I've gotten pretty close but I seem to be at a bit of
an impasse.

This screenshot shows what the map looks like with the default rendering:

http://imgur.com/fKvunfd

This screenshot shows what the map looks like after I apply my instance
rendering code to it:

http://imgur.com/zZCzurr

The map is composed of a lot of little nodes. I figured instanced rendering
would be helpful in this case. The map has ~4000 individual nodes. Two of
the nodes are repeated 465 and 266 times. I have trimmed down my code and
it is posted here:

http://pastebin.com/ifSVSzD6

>From what it looks like. Its rendering one copy of every nodes but not
anymore that that. I have commented out lines 215 to 224 as it doesn't work
at all. Any insight or help would be greatly appreciated.

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


Re: [osg-users] pick a point or line

2016-04-15 Thread Robert Osfield
Hi Zhouhan,

LineSegmentIntersector is only able to intersect surfaces.  For points and
lines you need to use another Intersector, either a custom one or the
osgSim::PolytopeInersector. The PolytopeIntersector allows you to use a
collection of planes to set up the picking region.

Robert.

On 6 April 2016 at 09:12, Han Zhou  wrote:

> Hi all,
>
> I'm working on an CAE software in which users need to setup some params on
> the boundary. I extract point, line, and face elements so that users can
> pick and choose them, and it will give a feedback, like change color.
> I referenced osgpick example and the OpenSceneGraph 3 cookbook, for
> surface picking, it is easy. Now the problem is, to pick a point or line,
> which is the best way to implement it? do I need to implement a Intersector
> subclass like LineSegmentIntersector?
>
> Thank you!
>
> Cheers,
> zhouhan
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66741#66741
>
>
>
>
>
> ___
> 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] pick a point or line

2016-04-15 Thread Han Zhou
Hi all,

I'm working on an CAE software in which users need to setup some params on the 
boundary. I extract point, line, and face elements so that users can pick and 
choose them, and it will give a feedback, like change color.
I referenced osgpick example and the OpenSceneGraph 3 cookbook, for surface 
picking, it is easy. Now the problem is, to pick a point or line, which is the 
best way to implement it? do I need to implement a Intersector subclass like 
LineSegmentIntersector?

Thank you!

Cheers,
zhouhan

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





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


Re: [osg-users] set proper size to window manager at startup

2016-04-15 Thread Gianni Ambrosio
I recently moved from OSG 3.0.1 to 3.4.0 and I'm getting this unexpected 
behaviour only with OSG 3.4.0. In fact comparing the code of 3.0.1 and 3.4.0 I 
realized the clear() call in EventQueue::setStartTick() is only present in 
3.4.0 code. I don't know the reason of that but from my point of view in 3.4.0 
setStartTick() does more that it says: setStartTick just have to set the tick 
non more than that. Moreover that modification (clear()) has broken the scenaio 
I described.

Gianni

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





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


Re: [osg-users] crash after resizing high resolutions

2016-04-15 Thread Robert Osfield
Hi Sebastian,

You might want to add a few more details about your OS, your hardware, OSG
version, memory footprint of your application, the strack trace at crash.
Without this there isn't too much others in the community can suggest.

Robert.

On 15 April 2016 at 12:44, Sebastian Schmidt 
wrote:

> Hi,
>
> Most of the time when i resize/decrease a window with high resolution (f.e
> 3860 x 2160) the app crashes. This is normally not the case in full hd and
> lower resolutions.
>
> The process of resizing the window takes to long. Maybe has something to
> do with sleep calls.
>
> In my special case the crash is possibly caused by a second plugin that is
> running and doesn't like it when the osg app is in this black window/
> intermediate state.
>
> Is there a hack to make the resizing process faster?
>
> ...
>
> Thank you!
>
> Cheers,
> Sebastian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66832#66832
>
>
>
>
>
> ___
> 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] crash after resizing high resolutions

2016-04-15 Thread Sebastian Schmidt
Hi,

Most of the time when i resize/decrease a window with high resolution (f.e 3860 
x 2160) the app crashes. This is normally not the case in full hd and lower 
resolutions.

The process of resizing the window takes to long. Maybe has something to do 
with sleep calls. 

In my special case the crash is possibly caused by a second plugin that is 
running and doesn't like it when the osg app is in this black window/ 
intermediate state.

Is there a hack to make the resizing process faster?

... 

Thank you!

Cheers,
Sebastian

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





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


Re: [osg-users] set proper size to window manager at startup

2016-04-15 Thread Gianni Ambrosio
The problem seems to be here:

osg130-osgGAd.dll!osgGA::EventQueue::clear()  Line 37   C++
osg130-osgGAd.dll!osgGA::EventQueue::setStartTick(__int64 tick)  Line 212 + 
0x25 bytes  C++
osg130-osgViewerd.dll!osgViewer::CompositeViewer::setStartTick(__int64 tick)  
Line 355 + 0x1d bytes C++
osg130-osgViewerd.dll!osgViewer::CompositeViewer::realize()  Line 646 + 0x31 
bytes  C++
osg130-osgViewerd.dll!osgViewer::ViewerBase::frame(double simulationTime)  Line 
678 + 0xf bytes C++
osgWidgetsTest.exe!ViewerWidget::paintEvent(QPaintEvent * event)  Line 154 + 
0x46 bytes C++

The first time a paint event is called, the eventqueue is cleaned up (see 
EventQueue::clear()) and the RESIZE event with correct width and height 
unavoidably lost!

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





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


Re: [osg-users] set proper size to window manager at startup

2016-04-15 Thread Gianni Ambrosio
I verified that when the application starts the code falls into the following 
method (osgQt\GraphicsWindowQt.cpp),

void GLWidget::resizeEvent( QResizeEvent* event )

where it seems a resize event is insert into the event queue with proper width 
and height:

_gw->getEventQueue()->windowResize( x(), y(), scaled_width, scaled_height );

but a RESIZE event is not passed to the ResizeHandler. Can anybody see a good 
reason or a bug there?

Regards,
Gianni

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





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


Re: [osg-users] Meteor falling

2016-04-15 Thread Sebastian Messerschmidt

Hi Tony

Hi Sebastian,
   In my case I am trying to simulate an illumination shell dropping from a 
height and lighting the scene below for a given duration so I don't have a 
model. Is it just a case of creating a node at the desired position and add a 
lightsource to it as per the osglightsource example? The shell is a ball of 
light. Can I specify the size of the light? And how do I make it self 
illuminating?
If you don't need a modelled shell you simply need a group with a 
osg::Lightsource and an associated osg::Light. A light is not 
represented by a geometry, so if you need this, simply use a textured 
billboard with lighting disabled or a sphere/whatever with emissive 
colors defined. The lightsource example can show you the light source 
part. The rest is basic OpenGL knowledge and there are a lot of examples 
for this. If you have further osg-centric questions feel free to ask.


Cheers
Sebastian




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


[osg-users] set proper size to window manager at startup

2016-04-15 Thread Gianni Ambrosio
Hi All,
I have a Qt application ad I have to initialize a WindowManager with some 
default width and height like follows:

osg::ref_ptr wm = new osgWidget::WindowManager(view, 
1280.0f, 1024.0f, MASK_2D, osgWidget::WindowManager::WM_USE_RENDERBINS);

When the Qt application starts up then the QWidget containing the OSG view is 
resized properly by the Qt framework but even if I use:

view->addEventHandler(new osgWidget::ResizeHandler(wm, camera));

an osgGA::GUIEventAdapter::RESIZE event is not raised at that point. That 
means, every OSG windows added to the WindowManager are not resized correctly. 
Only when the user interactiverly resizes the window of Qt application, then a 
osgGA::GUIEventAdapter::RESIZE is rised and, falling into 
ResizeHandler::handle() methodm the Window Manager is updated with proper width 
and height.

Now, which is the correct way you see to solve this issue?

Regards,
Gianni

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





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


Re: [osg-users] Meteor falling

2016-04-15 Thread Tony Vasile
Hi Sebastian,
  In my case I am trying to simulate an illumination shell dropping from a 
height and lighting the scene below for a given duration so I don't have a 
model. Is it just a case of creating a node at the desired position and add a 
lightsource to it as per the osglightsource example? The shell is a ball of 
light. Can I specify the size of the light? And how do I make it self 
illuminating?


Tony V

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





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


Re: [osg-users] Meteor falling

2016-04-15 Thread Sebastian Messerschmidt

Hi Tony,

I looking for an example of a meteor or an illumination source slowly falling 
to the ground. It would have to cast light as it falls. Does one exist or is 
this something I would have to create.
Attach a lightsource to a model (preferably selfilluminating) and 
control the path for instance with the animation path.


Cheers
Sebastian


Tony V

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





___
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