Re: [osg-users] Fetch png image from the web

2017-12-05 Thread Bruno Oliveira
I was wondering if OSG had wrappers for cUrl and libpng!

2017-12-02 19:27 GMT+00:00 Raymond de Vries <ree...@xs4all.nl>:

> Hi Bruno,
>
> Did you try it just by using a full url? I believe that when you have the
> curl plugin built, and the png plugin of course, it will work as you expect.
>
> Cheers
> Raymond
>
>
> Verstuurd vanaf mijn iPad
>
> > Op 2 dec. 2017 om 19:21 heeft Bruno Oliveira <
> bruno.manata.olive...@gmail.com> het volgende geschreven:
> >
> > Hey,
> > are there any helpers on OSG for downloading a PNG image from the web
> and creating a osg::Image object from it?
> > ___
> > 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


[osg-users] Fetch png image from the web

2017-12-02 Thread Bruno Oliveira
Hey,
are there any helpers on OSG for downloading a PNG image from the web and 
creating a osg::Image object from it?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] #include on MSVC results in errors

2017-07-11 Thread Bruno Oliveira
This is how I add the include folders of OSG on CMake

include_directories ( ${OPENSCENEGRAPH_INCLUDE_DIRS} )

is this correct?


2017-07-11 12:51 GMT+01:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> I agree. However, somehow, using CMake, the include/osgDB folder got
> appended to the include path This did not happen previously
>
> 2017-07-11 12:13 GMT+01:00 Voerman, L. <l.voer...@rug.nl>:
>
>> Hi Bruno,
>> it's very uncommon to have subfolder of osg\include in your include path,
>> like include\osgText.
>> The normal configuration has something like E:\dev\OpenSceneGraph\include
>> in the project include path, and requests the use of the osgText\String
>> with:
>> #include 
>>
>> this way there will be no confusion with the system string haeder files.
>> Regards, Laurens.
>>
>> On Tue, Jul 11, 2017 at 12:57 PM, Bruno Oliveira <
>> bruno.manata.olive...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Windows is not case sentitive, hence, on MSVC 2015,
>>>
>>> #include 
>>>
>>> is the same as
>>>
>>> #include 
>>>
>>> For this reason, I am including  to get std::string definitions,
>>> but MSVC is include  from OSG.
>>>
>>> Is there a way to fix this? I'm sure this has happened to more people.
>>>
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>> cenegraph.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] #include on MSVC results in errors

2017-07-11 Thread Bruno Oliveira
I agree. However, somehow, using CMake, the include/osgDB folder got
appended to the include path This did not happen previously

2017-07-11 12:13 GMT+01:00 Voerman, L. <l.voer...@rug.nl>:

> Hi Bruno,
> it's very uncommon to have subfolder of osg\include in your include path,
> like include\osgText.
> The normal configuration has something like E:\dev\OpenSceneGraph\include
> in the project include path, and requests the use of the osgText\String
> with:
> #include 
>
> this way there will be no confusion with the system string haeder files.
> Regards, Laurens.
>
> On Tue, Jul 11, 2017 at 12:57 PM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> Hello,
>>
>> Windows is not case sentitive, hence, on MSVC 2015,
>>
>> #include 
>>
>> is the same as
>>
>> #include 
>>
>> For this reason, I am including  to get std::string definitions,
>> but MSVC is include  from OSG.
>>
>> Is there a way to fix this? I'm sure this has happened to more people.
>>
>> ___
>> 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


[osg-users] #include on MSVC results in errors

2017-07-11 Thread Bruno Oliveira
Hello,

Windows is not case sentitive, hence, on MSVC 2015,

#include 

is the same as

#include 

For this reason, I am including  to get std::string definitions,
but MSVC is include  from OSG.

Is there a way to fix this? I'm sure this has happened to more people.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Wait for Database pager to complete

2017-07-09 Thread Bruno Oliveira
I am using ref_ptrs on the rendering part. However, my backend is not.

2017-07-07 16:23 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> HI Bruno,
>
> Make sure you are using ref_ptr<> in your ReadFileCallback for any
> scene graph data structures so if you remove nodes from the main scene
> graph they don't get deleted mid load.  If you do this properly then
> there should be no need to mess around with blocks that would
> complicate the code.
>
> Robert.
>
> On 7 July 2017 at 14:46, Bruno Oliveira <bruno.manata.olive...@gmail.com>
> wrote:
> > Hello,
> >
> > i have a PagedLOD bases scene.
> >
> > At some point I remove a node, but OSG sometimes is reading a subnode and
> > crashes at ReadFileCallback.
> >
> > I can solve this if there is some mechanism to wait for the current
> callback
> > to finish reading, like for instance a
> > osgDB::DataBasePager::waitForCurrentThreadToFinish() function.
> >
> > Is there something like this?
> >
> > ___
> > 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


[osg-users] Wait for Database pager to complete

2017-07-07 Thread Bruno Oliveira
Hello,

i have a PagedLOD bases scene.

At some point I remove a node, but OSG sometimes is reading a subnode and
crashes at ReadFileCallback.

I can solve this if there is some mechanism to wait for the current
callback to finish reading, like for instance a
osgDB::DataBasePager::waitForCurrentThreadToFinish() function.

Is there something like this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Escape Key

2017-07-03 Thread Bruno Oliveira
Hello,

I am using an event handler for catching keyboard's escape key.

However, my osgGA::GUIEventAdapter::getKey() returns 0x1B, when it should
be returning osgGA::GUIEventAdapter::KEY_Escape (which is 0xFF1B).

What's wrong here? the Osg's enum, or my code?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Limit rendering a texture up to a given pixel

2017-06-30 Thread Bruno Oliveira
Yes I implemented something like that! Thanks !

2017-06-29 19:45 GMT+01:00 Christian Buchner <christian.buch...@gmail.com>:

>
> A uniform specific to each tile that defines the dimensions for the valid
> part of the tile? The shader would get the gl_FragCoord, compare it against
> the threshold and return a transparent color for pixels outside the valid
> bounds.
>
> Christian
>
>
> 2017-06-29 11:28 GMT+02:00 Bruno Oliveira <bruno.manata.olive...@gmail.com
> >:
>
>> Hello,
>>
>>
>> I have a big image to be rendered (100k pixels each side), hence I am
>> partitioning that image in Image Tiles.
>>
>> Each tile has 256 x 256 pixels. Each tile consists of a osg::Geometry
>> quad, with a texture bound to it. I put all those tiles in an osg::Group.
>> I use a fragment shader that is global to all tiles (I apply it to the
>> osg::Group's StateSet). It is a very simple shader and consists only of a
>> texture lookup in each tile:
>>
>> gl_FragColor = texture2D(texture, vec2(x, y));
>>
>> The problem now is that in the image limits, some extra pixels are
>> rendered (because my images' size is not multiple of 256). For instance, if
>> my image size is 1000 pixels in x, the last 24 pixels are not valid and
>> shall be transparent (because it will have 4 tiles = 256 * 4 pixels =
>> 1024). The last tile should only be rendered up to the pixel 232 ( 256 - 24
>> = 232)
>>
>> What is the best way of limiting my rendering up to that pixel, WITHOUT
>> defining a new shader for EVERY tile? ( I really want a single fragment
>> shader bound to the whole group for performance reasons)
>>
>> ___
>> 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


[osg-users] Limit rendering a texture up to a given pixel

2017-06-29 Thread Bruno Oliveira
Hello,


I have a big image to be rendered (100k pixels each side), hence I am
partitioning that image in Image Tiles.

Each tile has 256 x 256 pixels. Each tile consists of a osg::Geometry quad,
with a texture bound to it. I put all those tiles in an osg::Group.
I use a fragment shader that is global to all tiles (I apply it to the
osg::Group's StateSet). It is a very simple shader and consists only of a
texture lookup in each tile:

gl_FragColor = texture2D(texture, vec2(x, y));

The problem now is that in the image limits, some extra pixels are rendered
(because my images' size is not multiple of 256). For instance, if my image
size is 1000 pixels in x, the last 24 pixels are not valid and shall be
transparent (because it will have 4 tiles = 256 * 4 pixels = 1024). The
last tile should only be rendered up to the pixel 232 ( 256 - 24 = 232)

What is the best way of limiting my rendering up to that pixel, WITHOUT
defining a new shader for EVERY tile? ( I really want a single fragment
shader bound to the whole group for performance reasons)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Perform actions when a child node is added

2017-06-26 Thread Bruno Oliveira
Robert,

a dangling pointer is a probable cause of my problems. Thanks for the hint,
I'll look into it.

I thought it could be related to me rewriting the node's InitialBound.

Thanks,
Bruno

2017-06-26 10:15 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> On 23 June 2017 at 23:45, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > I actually tried it already, in my nodes derived doth from osg::Group*
> and
> > osg::PagedLOD*.
> > However, overloading the PagedLOD's functions made my scene crash the app
> > during the cull traversal (my overload was rewriting the node's center,
> > radius and InitialBound...)
>
> If you've got a crash it'll likely be because what you are doing
> somewhere is buggy, perhaps an assumption somewhere.  Overriding
> addChild/insertChild() won't cause a crash if done properly.
>
> In the case of paged databases nodes are added and removed, the later
> can cause problems such as if your code just uses C pointers to these
> nodes assuming that they'll always be around.
>
> I can't say what might have caused the crash for you as I know nothing
> about the code you've written or what the crash is, or exactly what
> circumstances it happens in.
>
> You'll have a debugger, your have your code, your data, you're the
> person best placed to debug it.
>
> Robert.
> ___
> 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] Perform actions when a child node is added

2017-06-23 Thread Bruno Oliveira
I actually tried it already, in my nodes derived doth from osg::Group* and
osg::PagedLOD*.
However, overloading the PagedLOD's functions made my scene crash the app
during the cull traversal (my overload was rewriting the node's center,
radius and InitialBound...)

2017-06-23 15:18 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> HI Bruno,
>
> There is no "child added callback" mechanism in osg::Group, but you
> can override the addChild and insertChild methods to catch attempts to
> add children, deferring the implementation to the underlying
> addChild/insertChild method and then doing what extra's you want,
>
> Robert.
>
> On 23 June 2017 at 11:31, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > Hello,
> >
> >
> > I want to be able to perform some actions inside a node of my own, when
> > someone adds a child node to it.
> >
> > Is this possible via some callback mechanism or so?
> >
> >
> > --
> >
> > Also, another question. Using osgDB::Registry::ReadFileCallback, I can
> only
> > perform actions after a node is read and before it is added to me scene.
> Is
> > it possible to perform actions AFTER the node is read and added to the
> > scene?
> >
> >
> > Thanks.
> >
> > ___
> > 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


[osg-users] Perform actions when a child node is added

2017-06-23 Thread Bruno Oliveira
Hello,


I want to be able to perform some actions inside a node of my own, when
someone adds a child node to it.

Is this possible via some callback mechanism or so?


--

Also, another question. Using osgDB::Registry::ReadFileCallback, I can only
perform actions after a node is read and before it is added to me scene. Is
it possible to perform actions AFTER the node is read and added to the
scene?


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


Re: [osg-users] converting node coordinates

2017-06-22 Thread Bruno Oliveira
Probably it does, however I tried deactivating Culling and my scene is not
rendered properly anymore (some LOD nodes are not rendered).

My bounding spheres are correctly calculated. Are they set with
node->setInitialBound(calculatedBound);   ?

2017-06-22 18:54 GMT+01:00 sam <brko...@gmail.com>:

> When you zoom your mouse feel forward it's possible that the new sphere is
> outside the camera's view and thus being culled out of the drawing. Check
> to make sure the sphere doesn't end up behind the camera.
>
> On Thu, Jun 22, 2017 at 10:38 AM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> I am almost sure I am making some mistake on setting the node's bounding
>> sphere. Is my code correct on that example I gave?
>>
>> 2017-06-22 18:29 GMT+01:00 Bruno Oliveira <bruno.manata.oliveira@gmail.c
>> om>:
>>
>>> Sorry I'm not sure what you're asking.
>>>
>>> I manipulate my scene with a Mouse Manipulator (Trackball), hence the
>>> view is refreshed and I can see my nodes, but if I zoom in they disappear
>>>
>>> 2017-06-22 18:23 GMT+01:00 Sam Brkopac <brko...@gmail.com>:
>>>
>>>> Hi Bruno,
>>>>
>>>> After you manipulate the coordinates do the new bounds result in the
>>>> node getting culled by the camera?
>>>>
>>>> Thanks, Sam
>>>>
>>>> > On Jun 22, 2017, at 10:12, Bruno Oliveira <
>>>> bruno.manata.olive...@gmail.com> wrote:
>>>> >
>>>> > Hello,
>>>> >
>>>> > I have some osg::Nodes with some initial geometry coordinates.
>>>> >
>>>> > Then, after some rendering, at some point I need to transform those
>>>> initial coordinates. I do something like this:
>>>> >
>>>> >
>>>> > void MyNodeGeometry::convertCoordinates() {
>>>> >
>>>> > auto* vert = this->getVertexArray();
>>>> >
>>>> > for (int i = 0; i < vert->size(); i++) {
>>>> > convertCoordinate(vert->operator[](i));
>>>> > }
>>>> >
>>>> > this->setVertexArray(vert);
>>>> >
>>>> > this->setInitialBound(this->computeBound());
>>>> > this->firtyBound();
>>>> >
>>>> > }
>>>> >
>>>> >
>>>> > Also, in all parent Nodes I call
>>>> >
>>>> > parentNode->setInitialBound(this->computeBound());
>>>> > parent->firtyBound();
>>>> >
>>>> >
>>>> >
>>>> > However, when I do this, I can see my points, BUT when I try to
>>>> manipulate my scene with the mouse, the data disappears if I zoom in, and
>>>> appears again if I zoom out again.
>>>> > This seems like my node's bounds are not well set, But I manually
>>>> verified all node's bounds and they are correct
>>>> >
>>>> > Any idea?
>>>> > ___
>>>> > osg-users mailing list
>>>> > osg-users@lists.openscenegraph.org
>>>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>> cenegraph.org
>>>> ___
>>>> osg-users mailing list
>>>> osg-users@lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>> cenegraph.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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] converting node coordinates

2017-06-22 Thread Bruno Oliveira
I am almost sure I am making some mistake on setting the node's bounding
sphere. Is my code correct on that example I gave?

2017-06-22 18:29 GMT+01:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> Sorry I'm not sure what you're asking.
>
> I manipulate my scene with a Mouse Manipulator (Trackball), hence the view
> is refreshed and I can see my nodes, but if I zoom in they disappear
>
> 2017-06-22 18:23 GMT+01:00 Sam Brkopac <brko...@gmail.com>:
>
>> Hi Bruno,
>>
>> After you manipulate the coordinates do the new bounds result in the node
>> getting culled by the camera?
>>
>> Thanks, Sam
>>
>> > On Jun 22, 2017, at 10:12, Bruno Oliveira <
>> bruno.manata.olive...@gmail.com> wrote:
>> >
>> > Hello,
>> >
>> > I have some osg::Nodes with some initial geometry coordinates.
>> >
>> > Then, after some rendering, at some point I need to transform those
>> initial coordinates. I do something like this:
>> >
>> >
>> > void MyNodeGeometry::convertCoordinates() {
>> >
>> > auto* vert = this->getVertexArray();
>> >
>> > for (int i = 0; i < vert->size(); i++) {
>> > convertCoordinate(vert->operator[](i));
>> > }
>> >
>> > this->setVertexArray(vert);
>> >
>> > this->setInitialBound(this->computeBound());
>> > this->firtyBound();
>> >
>> > }
>> >
>> >
>> > Also, in all parent Nodes I call
>> >
>> > parentNode->setInitialBound(this->computeBound());
>> > parent->firtyBound();
>> >
>> >
>> >
>> > However, when I do this, I can see my points, BUT when I try to
>> manipulate my scene with the mouse, the data disappears if I zoom in, and
>> appears again if I zoom out again.
>> > This seems like my node's bounds are not well set, But I manually
>> verified all node's bounds and they are correct
>> >
>> > Any idea?
>> > ___
>> > osg-users mailing list
>> > osg-users@lists.openscenegraph.org
>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>> cenegraph.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


[osg-users] converting node coordinates

2017-06-22 Thread Bruno Oliveira
Hello,

I have some osg::Nodes with some initial geometry coordinates.

Then, after some rendering, at some point I need to transform those initial
coordinates. I do something like this:


void MyNodeGeometry::convertCoordinates() {

auto* vert = this->getVertexArray();

for (int i = 0; i < vert->size(); i++) {
convertCoordinate(vert->operator[](i));
}

this->setVertexArray(vert);

this->setInitialBound(this->computeBound());
this->firtyBound();

}


Also, in all parent Nodes I call

parentNode->setInitialBound(this->computeBound());
parent->firtyBound();



However, when I do this, I can see my points, BUT when I try to manipulate
my scene with the mouse, the data disappears if I zoom in, and appears
again if I zoom out again.
This seems like my node's bounds are not well set, But I manually verified
all node's bounds and they are correct

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


[osg-users] Render objects in geographic coordinates (radians)

2017-06-20 Thread Bruno Oliveira
Hello,

how can I render an object in geographic coordinates, i.e., XY are in
radians and Z in meters?

If I render it directly without performing any projection, my object is
rendered as a stright line along the x axis (which makes sense, since the
xy coordinates are contained in [-pi, pi] radians and Z in, for instance,
[-200, 200] meter
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Multiple definitions of MixInVector destructor

2017-06-06 Thread Bruno Oliveira
Hello,

anyone ever had this error?


ErrorLNK2005"public: virtual __cdecl
osg::MixinVector::~MixinVector(void)" (??1?$MixinVector@H@osg@
@UEAA@XZ) already defined in MyStaticLib.lib(SomeObject.obj)MAPP
osg.lib(osg130-osg.dll)


This happened to me today when compiling code under Windows. This code runs
successfully on UNIX systems.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Render Geographic/Projected coordinate nodes

2017-06-05 Thread Bruno Oliveira
How can I render a node in Geographic Coordinate Systems?

I tried rendering in WGS84 and got several problems (bad intersection
computation, bad Mouse handler).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Render point cloud in a different coordinate system

2017-06-05 Thread Bruno Oliveira
I have a big point cloud, which has points in meter coordinates. Now I want
to transform the coordinates of this cloud for rendering only, without
changing my point cloud data. How can I do this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Why not const pointers in array setters

2017-05-29 Thread Bruno Oliveira
Hello,


in array setters, for instance in osg::Geometry::setVertexArray, why is the
array argument non-const?

How bad is it that I const_cast an array of my into a Geometry?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Get RenderBinDetails

2017-05-29 Thread Bruno Oliveira
Thank you. Didn't realize the bin number was the same of bin details.

2017-05-24 11:43 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> From the include/osg/StateSet header:
>
> /** Set the render bin details.*/
> void setRenderBinDetails(int binNum,const std::string&
> binName,RenderBinMode mode=USE_RENDERBIN_DETAILS);
>
> ...
>
> /** Set the render bin number.*/
> inline void setBinNumber(int num) { _binNum=num; }
>
> /** Get the render bin number.*/
> inline int getBinNumber() const { return _binNum; }
>
> Robert.
>
> On 24 May 2017 at 10:44, Bruno Oliveira <bruno.manata.olive...@gmail.com>
> wrote:
> > Hello,
> >
> > in order to sort my nodes by depth, I use the following code to a node's
> > stateset
> >
> > nodeStateSet->setRenderBinDetails(order, "DepthSortedBin");
> >
> > where "order" is an int. Now, how do I get that value when I'm iterating
> > over my nodes?
> >
> > ___
> > 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


[osg-users] Get RenderBinDetails

2017-05-24 Thread Bruno Oliveira
Hello,

in order to sort my nodes by depth, I use the following code to a node's
stateset

nodeStateSet->setRenderBinDetails(order, "DepthSortedBin");

where "order" is an int. Now, how do I get that value when I'm iterating
over my nodes?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Draw instance quads not working

2017-05-23 Thread Bruno Oliveira
I found out what my problem was. Since I was adding to vectors, I needed to
set vec.w = 1;

Thanks anyway!

2017-05-22 20:31 GMT+01:00 Raymond de Vries <ree...@xs4all.nl>:

> Hi Bruno,
>
> Can you provide more information about your setup? Platform, gfx card, osg
> version, etc. Have you seen and tried the osg example osgdrawinstanced?
> Writing "not working" is probably too little info for people to help you ;-)
>
> Cheers,
> Raymond
>
>
>
>
> On 5/22/2017 8:17 PM, Bruno Oliveira wrote:
>
> Hi,
>
>
> I want to render several simple quads ( a simple rectangle). I pass the
> quad centers via a 2D texture, and try to render them with the following
> vertex shader:
>
>
>
> "#version 120\n"
> "#extension GL_EXT_draw_instanced : enable\n"
> "\n"
> "uniform sampler2D texVert;\n"
> "uniform sampler2D texColor;\n"
> "uniform float  texSize;\n"
> "\n"
> "void main() {\n"
> "\n"
> "  float row   = float(gl_InstanceID) / texSize;\n"
> "\n"
> "  vec2  uv= vec2(fract(row), floor(row) / texSize);\n"
> "  vec4  vert  = gl_Vertex + texture2D(texVert, uv);\n"
> "\n"
> "  gl_Position = gl_ModelViewProjectionMatrix * vert;\n"
> "\n"
> "}\n"
>
>
>
> *This is my code for creating 1000 quads:*
>
> this->setUseDisplayList(false),
> this->setUseVertexBufferObjects(true);
>
> // Build Geometry
> // Simple Quad
>   osg::ref_ptr vertices = new osg::Vec3Array(4);
>   (*vertices)[0].set(-500, -500, 0.f );
>   (*vertices)[1].set( 500, -500, 0.f );
>   (*vertices)[2].set( 500,  500, 0.f );
>   (*vertices)[3].set(-500,  500, 0.f );
>
>   this->setUseDisplayList(false);
>   this->setUseVertexBufferObjects(true);
>   this->setVertexArray(vertices.get());
>   this->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4, 1000));
>
>
> *IMPORTANT NOTE*:
> *If I use simple GL_POINTS, my code works fine and renders correclty 1000
> points: *
>
>   osg::ref_ptr vertices = new osg::Vec3Array(1);
>   (*vertices)[0].set(0, 0, 0.f );
>
>   this->setVertexArray(vertices);
>
> this->addPrimitiveSet( new osg::DrawArrays(GL_POINTS, 0, 1, 1000) );
>
>
>
>
> --
> [image: AVG logo] <http://www.avg.com/internet-security>
>
> This email has been checked for viruses by AVG antivirus software.
> www.avg.com <http://www.avg.com/internet-security>
>
> <#m_6652820044422372515_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>
> ___
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Draw instance quads not working

2017-05-22 Thread Bruno Oliveira
Hi,


I want to render several simple quads ( a simple rectangle). I pass the
quad centers via a 2D texture, and try to render them with the following
vertex shader:



"#version 120\n"
"#extension GL_EXT_draw_instanced : enable\n"
"\n"
"uniform sampler2D texVert;\n"
"uniform sampler2D texColor;\n"
"uniform float  texSize;\n"
"\n"
"void main() {\n"
"\n"
"  float row   = float(gl_InstanceID) / texSize;\n"
"\n"
"  vec2  uv= vec2(fract(row), floor(row) / texSize);\n"
"  vec4  vert  = gl_Vertex + texture2D(texVert, uv);\n"
"\n"
"  gl_Position = gl_ModelViewProjectionMatrix * vert;\n"
"\n"
"}\n"



*This is my code for creating 1000 quads:*

this->setUseDisplayList(false),
this->setUseVertexBufferObjects(true);

// Build Geometry
// Simple Quad
  osg::ref_ptr vertices = new osg::Vec3Array(4);
  (*vertices)[0].set(-500, -500, 0.f );
  (*vertices)[1].set( 500, -500, 0.f );
  (*vertices)[2].set( 500,  500, 0.f );
  (*vertices)[3].set(-500,  500, 0.f );

  this->setUseDisplayList(false);
  this->setUseVertexBufferObjects(true);
  this->setVertexArray(vertices.get());
  this->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4, 1000));


*IMPORTANT NOTE*:
*If I use simple GL_POINTS, my code works fine and renders correclty 1000
points:*

  osg::ref_ptr vertices = new osg::Vec3Array(1);
  (*vertices)[0].set(0, 0, 0.f );

  this->setVertexArray(vertices);

this->addPrimitiveSet( new osg::DrawArrays(GL_POINTS, 0, 1, 1000) );
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Enable Vertex Attribute Arrays

2017-03-20 Thread Bruno Oliveira
Hello,

is there anything I need to do in OSG to enable usage of
VertexAttributeArrays?

Like for instance in OpenGL you need to call glEnableVertexAttribArray()
(see
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glEnableVertexAttribArray.xml
)

I am using OSG 3.4.0 and simply can't make vertex attribute arrays to work
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Setting vertex attribute array of float

2017-03-20 Thread Bruno Oliveira
Hello,

I have a point cloud and I need to pass some float attribute. I need one
flag per vertex, so I am using vertex attribute array.

Here's how I do it:




*osg::Geometry* geom = (...);osg::ref_ptr vvv(new
osg::FloatArray());*


*for (int i = 0; i < nPoints; i++) vvv->push_back(0.);*

*geom->setVertexAttribArray(20, vvv);geom->setVertexAttribBinding(20,
osg::Geometry::BIND_PER_VERTEX);*


Then I create a osg::Program and bind the attribute as follows:


*m_program->addBindAttribLocation("classif", 20); *


And here's my vertex shader that paints the vertices as *white* if the
attribute "classif" is > 0.1 and *red* otherwise:
















*// Vertex Shader"varying   vec4 vcolor;\n"
"attribute float classif;\n""\n""void
main()\n""{\n""  vcolor  = ((classif > 0.1) ?
vec4(1., 1., 1., 1.) : vec4(1., 0., 0. ,1.));\n""  gl_Position
= ftransform();\n""}\n",// Fragment Shader
"varying vec4 vcolor;\n""void main() {\n""
gl_FragColor = vcolor;\n""}"*



Now, what happens is that, despite I set all attributes to 0., all the
points appear as white (i.e. the shader is interpreting the attribute as >
0.1). And no matter what values I put on the attributes, the vertices are
always rendered as white.

Any hints on why this is happening?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Encapsulate ttf in binary app

2017-02-02 Thread Bruno Oliveira
Hello,

for using with osgText, is there a way of using some .tff file (it can be
one from the OSG), without having to pack the .ttf file itself with the
binary distribution of the app?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Heap Corruption

2017-01-10 Thread Bruno Oliveira
If you managed to solve the problem, forget it.
Else, take a look at this:

http://stackoverflow.com/questions/7705724/shared-memory-in-dlls

2017-01-10 13:26 GMT+00:00 Théo Nassour :

> Hi every one, and thanks for you're replies,
>
> I am sorry Bruno but, i havent understood what you Said. Can you explain
> more please :
>
> > Another possibility is that your code is allocating and deallocating
> memory in separate module DLLs. However, in Windows, each DLL has separate
> memory spaces and that cannot be done.
> >
> >
> > You should check if that's the case by any reason (e.g. creating a
> osg::ref_ptr in a dll of your own and allowing osg::ref_ptr to be
> deallocaed automatically by another dll module).
> >
> > This is solved by providing proper deallocators.
> >
>
>
> And Voerman
> Thanks and will disable All osg notify in this case, cause we are using
> commong logging from Nugget packages.
>
>
> Thank you!
>
> Cheers,
> Théo
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69950#69950
>
>
>
>
>
> ___
> 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] Heap Corruption

2017-01-10 Thread Bruno Oliveira
Another possibility is that your code is allocating and deallocating memory
in separate module DLLs. However, in Windows, each DLL has separate memory
spaces and that cannot be done.

You should check if that's the case by any reason (e.g. creating a
osg::ref_ptr in a dll of your own and allowing osg::ref_ptr to be
deallocaed automatically by another dll module).
This is solved by providing proper deallocators.

2017-01-10 12:04 GMT+00:00 Voerman, L. :

> Hi Théo,
> I think you basically found out that the osg notify system is not thread
> safe, the call to osg::Notify from
> osg130-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Drawable & drawable)
> Line 1036C++
> OSG_NOTICE<<"CullVisitor::apply(Geode&) detected NaN,"
> is probably running in parallel with a different thread calling
> osg::Notify as well while triggering a resize of the buffer (too).
> Setting OSG_NOTIFY_LEVEL=WARN will probably avoid this crash.
>
> Regards, Laurens.
>
> On Tue, Jan 10, 2017 at 12:39 PM, Alberto Luaces  wrote:
>
>> Ok, the next I would do is to see what is OSG trying to print in this
>> stack frame (the ninth from the beginning):
>>
>>  osg130-osgUtild.dll!std::operator<<> >(std::basic_ostream & _Ostr, const char *
>> _Val) Line 806C++
>>
>> maybe that could serve as a hint...
>>
>> --
>> Alberto
>>
>> ___
>> 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 vertex as Circle with color given by some Vec4 array

2017-01-05 Thread Bruno Oliveira
Hi all,

Tracje: thanks a lot, that's something like this that I was needing.
Robert: I've tried that approach, the problem is that I need to define
point's sizes in World coordinates, not in pixel! Is this possible with
PointSprites in any way?

2017-01-05 10:47 GMT+00:00 Robert Osfield :

> HI Bruno,
>
> It sounds like point sprites would be sufficient for you purpose, no
> need to use shaders.  Have a look at the osgpointsprite example.
>
> Robert.
> ___
> 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 vertex as Circle with color given by some Vec4 array

2017-01-05 Thread Bruno Oliveira
Hi all,

*Tracje*: thanks a lot, that's something like this that I was needing.


*Robert*: I've tried that approach, the problem is that I need to define
point's sizes in World coordinates, not in pixel! Is this possible with
PointSprites in any way?

2017-01-05 20:03 GMT+00:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> Hi all,
>
> Tracje: thanks a lot, that's something like this that I was needing.
> Robert: I've tried that approach, the problem is that I need to define
> point's sizes in World coordinates, not in pixel! Is this possible with
> PointSprites in any way?
>
> 2017-01-05 10:47 GMT+00:00 Robert Osfield <robert.osfi...@gmail.com>:
>
>> HI Bruno,
>>
>> It sounds like point sprites would be sufficient for you purpose, no
>> need to use shaders.  Have a look at the osgpointsprite example.
>>
>> Robert.
>> ___
>> 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 intersections

2017-01-03 Thread Bruno Oliveira
Hi TianZJ, Thanks for the quick answer.

I checked the intersector, but intersector->getIntersections() returns no
intersections at all.



2017-01-03 9:32 GMT+00:00 tianzjyh <tianz...@126.com>:

> Hi, Oliveira,
> You can check the intersections of your intersector(e.g.
> LineSegmentIntersector::Intersection), and you will find they contain an
> "osg::NodePath", which means the whole path of the node(e.g. matrix
> transform nodes upon the drawable instance).
>
>
> --
>
>
> Cheers,
> ---
> TianZJ
>
> At 2017-01-03 16:58:16, "Bruno Oliveira" <bruno.manata.olive...@gmail.com>
> wrote:
>
> Hello,
>
> I'm implementing a draw instanced optimized scene. This is for drawing a
> set of polygons.
>
> Previously I was creating a drawable for each polygon, but now I am using
> draw instancing. With one drawable per polygon I can easily use osg
> intersectors for computing scene intersections. But how can I perform scene
> intersections with draw instanced objects and get, for instance,
> intersected instance IDs?
>
>
>
>
>
> ___
> 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 intersections

2017-01-03 Thread Bruno Oliveira
Hello,

I'm implementing a draw instanced optimized scene. This is for drawing a
set of polygons.

Previously I was creating a drawable for each polygon, but now I am using
draw instancing. With one drawable per polygon I can easily use osg
intersectors for computing scene intersections. But how can I perform scene
intersections with draw instanced objects and get, for instance,
intersected instance IDs?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Draw vertex as Circle with color given by some Vec4 array

2017-01-02 Thread Bruno Oliveira
Hi Nick,
thanks for your answer. I read the osgvertexattributes.cpp example and did
not quite get it at first. Do you know if there are any further
documentation or snippets I could read?

Or maybe if you have quick snippets it could spare me some valuable time.

2017-01-02 20:56 GMT+00:00 Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com>:

> Hi Bruno,
>
> yes, you can pass VertexAttributes to the program and look them up in the
> shader. You can pass the centers as Vec3Array, Vec4Array for colors and
> probably encode the radius into float array or the vertex.w() from the
> vertex array.
>
> Do a search through the examples for how to set up your program with
> VertexAttributes ... Ping me if you if troubles, I might be able to give
> some snippets
>
> Cheers,
> Nick
>
> On Mon, Jan 2, 2017 at 8:21 PM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> Hello,
>>
>>
>> I have an array of 3d points that I want to render in a scene. I want to
>> render them as circles, centered on each point coordinates, with a given
>> radius and a color that is given by a color array I have in memory.
>>
>> For now, I am creating a node for each point, that consists of a
>> PrimitiveSet (polygon) that I iterate around the point center. (Check code
>> below).
>>
>>
>> Now I know this can be done with Shaders. I can draw the circle directly
>> in the fragment shader with this example (http://www.geeks3d.com/201307
>> 05/shader-library-circle-disc-fake-sphere-in-glsl-opengl-glslhacker/).
>>
>> But I need to pass the vertex centers and respective colors. Is it
>> possible to pass a osg::Vec3Array* with vertex centers and a
>> osg::Vec4Array* of colors directly to a Shader, so that I can , in a single
>> compiled Shader program, handle all point positions and colors?
>>
>> Here is teh code for drawing the circle, I use this for each vertex:
>>
>> osg::Vec3Array* getArray(const float radius, const int points, const
>> osg::Vec3& center) {
>> auto array = new osg::Vec3Array();
>> const float ratio = (float(2.0*osg::PI) / float(points));
>> for (int i = 0; i < points; i++) {
>> const float angle = float(i) * ratio;
>> array->push_back(osg::Vec3(
>> center.x() + radius*cosf( angle ),
>> center.y() + radius*sinf( angle ),
>> center.z())
>> );
>> }
>> return array;
>> }
>>
>> osg::Geometry* getGeometry(const float radius, const int points, const
>> osg::Vec3& center) {
>> osg::Geometry* geom = new osg::Geometry();
>>
>> geom->setVertexArray(getArray(radius, points, center));
>> geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,
>> 0, points));
>>
>> return geom;
>> }
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> trajce nikolov nick
>
> ___
> 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 vertex as Circle with color given by some Vec4 array

2017-01-02 Thread Bruno Oliveira
Hello,


I have an array of 3d points that I want to render in a scene. I want to
render them as circles, centered on each point coordinates, with a given
radius and a color that is given by a color array I have in memory.

For now, I am creating a node for each point, that consists of a
PrimitiveSet (polygon) that I iterate around the point center. (Check code
below).


Now I know this can be done with Shaders. I can draw the circle directly in
the fragment shader with this example (
http://www.geeks3d.com/20130705/shader-library-circle-disc-fake-sphere-in-glsl-opengl-glslhacker/).


But I need to pass the vertex centers and respective colors. Is it possible
to pass a osg::Vec3Array* with vertex centers and a osg::Vec4Array* of
colors directly to a Shader, so that I can , in a single compiled Shader
program, handle all point positions and colors?

Here is teh code for drawing the circle, I use this for each vertex:

osg::Vec3Array* getArray(const float radius, const int points, const
osg::Vec3& center) {
auto array = new osg::Vec3Array();
const float ratio = (float(2.0*osg::PI) / float(points));
for (int i = 0; i < points; i++) {
const float angle = float(i) * ratio;
array->push_back(osg::Vec3(
center.x() + radius*cosf( angle ),
center.y() + radius*sinf( angle ),
center.z())
);
}
return array;
}

osg::Geometry* getGeometry(const float radius, const int points, const
osg::Vec3& center) {
osg::Geometry* geom = new osg::Geometry();

geom->setVertexArray(getArray(radius, points, center));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,
0, points));

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


[osg-users] Intersect Point Cloud wth precision

2016-12-22 Thread Bruno Oliveira
Hello,

I have a point cloud and need to get the intersection of my mouse with that
point cloud. For that I use a PolytopeIntersector. I use this intersector
because I found out that a LineSegmentIntersector will not do the trick.

I set the polytope width and height to 5.0 and therefore I get lots of
intersections, which is not good for me since I need to get the neartest
intersection to my mouse, and if I pick the first intersection of the
polytope I am not guaranteed to have that. A way of doing this would be to
change the polytope size to, for instance, 1.0 or 0.5, but this sometimes
results in no intersections.

How can I get the cloud point that is neartest to the polytope's center?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Scroll not working properly on MacOS

2016-12-13 Thread Bruno Oliveira
Hello,

in MacOS, when using Qt as a frontend manager along with OSG contexts, I
realised that scrolling with external mouse is not working properly: if I
use the TrackballManipulator, all the mouse does is zooming in. However, if
I use the laptop's trackpad, the zoom works fine.
I think this may be related to Qt directly.I am catching Mouse events and
passing them via the osg getEventQueue() and  osgGA::GUIEventAdapters.

Does anyone has a hint on why is this happening?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PolytopeIntersector with AutoTransform

2016-12-04 Thread Bruno Oliveira
Thanks for the answer.
How could I solve this?

2016-12-04 12:47 GMT+00:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> The complication with AutoTransform is the it computes it's values
> only in the CullVisitor so you'll inherit what ever the last frame
> used for it's settings.  This should work OK most of the time. If you
> have multiple views on the scene this will mean that there are
> multiple stats but only the last one will be left in place for the
> next frame.
>
> Robert.
>
>
>
> On 3 December 2016 at 17:55, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > Hello,
> >
> > in my scene graph I'm using an AutoTransform to add a circle with
> Radius=10,
> > centered on (0,0,0):
> >
> >   float Radius = 10;
> >   for (int i = 0; i < nPointsInCircle; i++)
> > vertArray[i] = Vec3d( radius * sin(...), radius* cos(...), 0.));
> >
> > then I add this to a Drawable + Geode, and add that Geode to an
> > AutoTransform:
> >
> >   auto* autoTransform = new osg::AutoTransform;
> >   autoTransform->addChild(circleGeode);
> >   autoTransform->setAutoScaleToScreen(true);
> >   autoTransform->setPosition(100, 100, 0);
> >
> > This results in a circle located in (100, 100, 0), with radius 10,
> scaling
> > automatically to screen. VISUALLY this is what I want.
> > Now when I use a PolytopeIntersector on this node, it returns
> intersection
> > coordinates of the circle , in the Circle's geometry frame, centered in
> > (0,0,0) with radius 10. This means that, if I hover my mouse over the
> > Circle, which is located in world coordinates in (100, 100, 0), the
> > PolytopeIntersector returns coordinates centered in (0,0,0) with maximum
> > radius 10.
> >
> >
> > How can I obtain true world coordinates with Autotransforms?
> >
> > ___
> > 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


[osg-users] PolytopeIntersector with AutoTransform

2016-12-03 Thread Bruno Oliveira
Hello,

in my scene graph I'm using an AutoTransform to add a circle with
Radius=10, centered on (0,0,0):

  float Radius = 10;
  for (int i = 0; i < nPointsInCircle; i++)
vertArray[i] = Vec3d( radius * sin(...), radius* cos(...), 0.));

then I add this to a Drawable + Geode, and add that Geode to an
AutoTransform:

  auto* autoTransform = new osg::AutoTransform;
  autoTransform->addChild(circleGeode);
  autoTransform->setAutoScaleToScreen(true);
  autoTransform->setPosition(100, 100, 0);

This results in a circle located in (100, 100, 0), with radius 10, scaling
automatically to screen. VISUALLY this is what I want.
Now when I use a PolytopeIntersector on this node, it returns intersection
coordinates of the circle , in the Circle's geometry frame, centered in
(0,0,0) with radius 10. This means that, if I hover my mouse over the
Circle, which is located in world coordinates in (100, 100, 0), the
PolytopeIntersector returns coordinates centered in (0,0,0) with maximum
radius 10.


How can I obtain true world coordinates with Autotransforms?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Deriving from osg::Geometry

2016-12-01 Thread Bruno Oliveira
Hello,

I created a custom class derived from osg::Geometry. Everything is
displayed correctly.

However, when I use a PolytopeIntersector in my scene graph, I get a seg
fault in


*osgUtil::PolytopeIntersector::intersect():*
* osg::Drawable::getBoundingBox() const*

If I call getBoundingBox myself to my geometry child, it works fine.

Why could this be happening?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] GUIEventHandler osgGA::GUIEventAdapter::RELEASE

2016-11-28 Thread Bruno Oliveira
Hello,

I created a custom osgGA::GUIEventHandler.
It handles both mouse click(push) and release.

In both cases (click/push and release) I do

bool Handler::handle(const osgGA::GUIEventAdapter&
ea,osgGA::GUIActionAdapter& aa) {

unsigned int buttonMask = ea.getButtonMask();

}

If the event is a mouse push event, buttonMask is OK. If it is a release
event, buttonMask is always zero. Is there any internal reason for this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to render the image without reducing its size.?

2016-11-22 Thread Bruno Oliveira
You should split your image in tiles!

2016-11-22 14:23 GMT+00:00 Uma Devi Selvaraj :

> Hi,
>
>Thank you all for the reply.
> ...
>
> Thank you!
>
> Cheers,
> Uma
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69474#69474
>
>
>
>
>
> ___
> 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 geometry that keeps its size in screen even with user manipulation (scaling, etc)

2016-11-21 Thread Bruno Oliveira
Thank you Tracje,

however I tried using that. My node has, for instance, 10 circles that
represent points and that are at a certain distance. I use autotransform on
the whole node of 10 circles with "setAutoScaleToScreen(true);" but what
happens is that when I zoom my scene, the distance between the circles does
not change.
Do I need to add an autotransform for each circle?

2016-11-21 16:20 GMT+00:00 Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com>:

> Hi Bruno,
>
> maybe you can have a look at osg::AutoTransform
>
> On Mon, Nov 21, 2016 at 4:08 PM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> Hello,
>>
>> I am drawing some basic shapes/geometries (in this case, some rectangles
>> or circles), but need them to have fixed size in screen pixel coordinates,
>> even when the user manipulates the scene.
>>
>> For instance, I want to draw rectangles that are 10-pixel wide, and keep
>> these 10 pixels even when the user zooms in or zooms out the scene.
>>
>> How can I do this?
>>
>>
>> ( I think this can't be accomplished with osg::Transform::ABSOLUTE_RF,
>> since I want the shapes to translate/rotate when user manipulates the scene)
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> trajce nikolov nick
>
> ___
> 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 geometry that keeps its size in screen even with user manipulation (scaling, etc)

2016-11-21 Thread Bruno Oliveira
Hello,

I am drawing some basic shapes/geometries (in this case, some rectangles or
circles), but need them to have fixed size in screen pixel coordinates,
even when the user manipulates the scene.

For instance, I want to draw rectangles that are 10-pixel wide, and keep
these 10 pixels even when the user zooms in or zooms out the scene.

How can I do this?


( I think this can't be accomplished with osg::Transform::ABSOLUTE_RF,
since I want the shapes to translate/rotate when user manipulates the scene)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Draw open polygon

2016-11-17 Thread Bruno Oliveira
Thank you Robert, that's perfect!

2016-11-17 10:24 GMT+00:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> On 17 November 2016 at 10:11, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > How does one draw an open polygon using whether OSG API's or OpenGL
> > primitives?
> > I know how to draw, for instance, a filled rectangle, but how do I draw a
> > filled rectangle with a hole inside?
> >
> > My data structures are stored as follows: a vector of the outward
> polygon's
> > vertices in clockwise order (e.g. filled rectangle), and then a vector of
> > "holes" stored as a vector of vertices in counter-clockwise order
>
> The osgUtil::Tessellator will be able to take these polygons and
> generate an osg::Geometry for you.  See the osgtessellate example.
>
> Robert.
> ___
> 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] Migrate shaders to glsl 4.1

2016-11-17 Thread Bruno Oliveira
I've been trying to migrate my shaders to OpenGL 4.1.

What is the alternative to the fixed pipeline code, of the vertex shader:

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform();


I know I have ot create my own out vector, like "out vec4 texcoord", but
where do I get OSG's View, Model, etc matrices?

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


[osg-users] Draw open polygon

2016-11-17 Thread Bruno Oliveira
Hello,

How does one draw an open polygon using whether OSG API's or OpenGL
primitives?
I know how to draw, for instance, a filled rectangle, but how do I draw a
filled rectangle with a hole inside?

My data structures are stored as follows: a vector of the outward polygon's
vertices in clockwise order (e.g. filled rectangle), and then a vector of
"holes" stored as a vector of vertices in counter-clockwise order
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] glsl version 130 not supported (and related problems)

2016-11-14 Thread Bruno Oliveira
Well I did some more research, and once again tried to tackled this
problem. If someone has already tried to use the current master branch on
OSX 10.12, could maybe give me some more in
I am using Qt 5.7 by the way.

This is what I tried so far:
Clone current master (which has, I think, the VAO branch merge onto it).
On CMake selected OPENGL_PROFILE=GLCORE. Deactivated GL1 and GL2 support,
activated GL3 support,and *deactivated* :
OSG_GL_FIXED_FUNCTION_AVAILABLE
OSG_GL_DISPLAYLISTS__AVAILABLE
OSG_GL_VERTEX_FUNCS_AVAILABLE
Compiled and installed, everything went smoothly.

Then in my app, I have to request a Core Profile. I am doing so using Qt's
QSurfaceFormat::setDefaultFormat() so request a OpenGL 3.2 Core Profile.

Also, in my OSG code, before I instantiate an osgViewer::Viewer, I use (as
Robert suggested)
osg::DisplaySettings::instance()->setVertexBufferHint(osg::
DisplaySettings::VERTEX_ARRAY_OBJECT);
and this effectively makes OSG print a message indicating it is requesting
the usage of VAO objects.


Now, with this setup, nothing is rendered on the screen, and I get lots of
shader compilation errors (These come from Qt). If I DON'T asctivate the
Core profile using the Qt API, These errsod o not appear, but when I try to
render a point cloud in a PagedLOD node, only white points start to appear
and after some LOD's are loaded the app crashes.


2016-11-13 15:21 GMT+00:00 Robert Osfield <robert.osfi...@gmail.com>:

> On 12 November 2016 at 22:24, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > I was now trying to solve this and searched for OSX VAO related posts,
> but
> > could not find relevant instructions on how to compile for OpenGL Core
> > Profile under OSX. Could you perhaps give some link to those discussions?
>
> As I'm not an OSX user I can't personally answer this without goig
> searching the mailing list/forum archives and the website.  Pointless
> me doing it when you could do it.
>
> Robert.
> ___
> 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] glsl version 130 not supported (and related problems)

2016-11-12 Thread Bruno Oliveira
Hello,

I was now trying to solve this and searched for OSX VAO related posts, but
could not find relevant instructions on how to compile for OpenGL Core
Profile under OSX. Could you perhaps give some link to those discussions?

2016-10-26 9:00 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> On 25 October 2016 at 23:53, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > I'm sorry but that did not work for me. I indeed created a new clone of
> the
> > OSG's master, recompiled OSG along with my app and I get a huge amount of
> > 'invalid operation' errors when trying to draw a simple scene that would
> > otherwise work...
>
> When I shortly after I first announced the vertex_array_object branch
> I asked for feedback on OSX GL3 core profile support and got feedback
> that the new VAO support for functioning and enabling GL3 usage under
> OSX.
>
> I don't have a OSX system so can't personally test, the best I can do
> provide general directions for others who have OSX to do testing and
> roll in any fixes that are required.
>
> For yourself I would recommend having a look through the threads on
> VAO over the last two months looking for discussions on the OSX, this
> might help you on your way.
>
> You'll also need patience, Apple over the years have made various
> changes that break builds and runtimes, or limit functionality to a
> narrow set of usage cases. Over the years I have worked under OSX at
> different points, but these days I'm more than happy to stay away from
> OSX, Apple have moved the goal posts so many times that it's a painful
> platform to support.  I say this prepare you for the effort required
> to port and then maintain your application on OSX, giving you the
> required time and resources for OSX  support is something that your
> management will need to be aware of and supportive of.
>
> On the OSG side I can't wave a magic wand and fix all the problems,
> one of the main motivations for adding VAO support to the OSG was
> fixing things under OSX.  I spent 6 weeks work unpaid on this to make
> it possible but as I don't have OSX I can't do the final testing.
> Others in the OSG that have OSX will need to help refine things if
> they need it and support each other.
>
> Robert.
> ___
> 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 RenderBin reverse order

2016-11-07 Thread Bruno Oliveira
Hello,

I'm using RenderBins to display overlapping textures that are contained in
separate geodes. All my geodes are at z = 0.f, so using a standard depth
test is not good for me. I need to use the RenderBin order, but I need to
reverse the order (i.e, if I give a binNum of 0 to a node, I want that node
to be rendered on top of everything, if I give a binNum of 1, is would be
under that first node, and so on. In other words, the bin Num I want to
give is the reverse order a bin is drawn. Is this possible?

I am using the following code:

  osg::StateSet ss = new StateSet;
  ss->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
  ss->setRenderBinDetails(depth, "DepthSortedBin");
  geode->setStateSet(ss);


By searching through the forum, I thought that using "DepthSortedBin" would
guarantee that the render order would be reversed, but it isn't. (By the
way it yields the same result of "RenderBin"), so I misunderstood this
argument).

How can I use reverse order of the RenderBin index?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Scene displaced from (0, 0, 0)

2016-11-03 Thread Bruno Oliveira
Hello,

I have a 3d scene that I manipulate with a TrackballManipulator, and setup
a scene in which all nodes are centred in (5, 1).

Now when I try to do use the home() function, I can't see my nodes. But if
I center my scene around (0, 0, 0), my nodes appear.
Should I use something else than home() to center my camera?

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


Re: [osg-users] glsl version 130 not supported (and related problems)

2016-10-25 Thread Bruno Oliveira
I'm sorry but that did not work for me. I indeed created a new clone of the
OSG's master, recompiled OSG along with my app and I get a huge amount of
'invalid operation' errors when trying to draw a simple scene that would
otherwise work...

2016-10-24 13:36 GMT+01:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> Thank you Robert for the extensive answer. I will test it today and
> provide feedback ASAP. Unfortunately OSX support is a requirement for my
> software.
>
> Thank you Tony for the link. I think you're right. It's probably some
> marketing strategy.
>
> 2016-10-24 9:10 GMT+01:00 Tony Vasile <ming...@gmail.com>:
>
>> This may also help: http://stackoverflow.com/quest
>> ions/19865463/opengl-4-1-under-mavericks . It seems the Apple have truly
>> crippled their OpenGL support  or they want everyone to write Objective C
>> under XCode.
>>
>> 
>> Tony V
>>
>> --
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=69131#69131
>>
>>
>>
>>
>>
>> ___
>> 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] glsl version 130 not supported (and related problems)

2016-10-24 Thread Bruno Oliveira
Thank you Robert for the extensive answer. I will test it today and provide
feedback ASAP. Unfortunately OSX support is a requirement for my software.

Thank you Tony for the link. I think you're right. It's probably some
marketing strategy.

2016-10-24 9:10 GMT+01:00 Tony Vasile :

> This may also help: http://stackoverflow.com/
> questions/19865463/opengl-4-1-under-mavericks . It seems the Apple have
> truly crippled their OpenGL support  or they want everyone to write
> Objective C under XCode.
>
> 
> Tony V
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69131#69131
>
>
>
>
>
> ___
> 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] glsl version 130 not supported (and related problems)

2016-10-22 Thread Bruno Oliveira
Hello,

I am using a fragment shader that requires #version 130
I use OSG 3.5.5 and Qt 5.7 on MacOS 10.12

This results in a shader compilation error, 'version 130 not supported'

I tried compiling OSG with GL3 enabled, but the error persists. Then I
tried to activate a Core Profile globally in Qt using QFurfaceFormat (just
ensures that a 3.3. Core profile is set globally for all widgets): but
after I do this and start using a Core profile, I get tons of errors from
OSG pipeline and can't render anything at all.


What should I do here?

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


Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
I'm starting to think that this is some OSG bug / inconsistency.

If I give up on Texture2DArray and upload a SINGLE Texture2D, if I use
GL_R8UI as internalFormat and GL_RED_INTEGER as pixelFormat, everythning
works perfectly.

2016-10-21 14:54 GMT+01:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> Thanks. However, I am already doing that!
>
> 2016-10-21 14:51 GMT+01:00 Glenn Waldron <gwald...@gmail.com>:
>
>> Bruno,
>> According to this thread you might also need to set your packing to 1 (in
>> the image->setImage call).
>> (https://goo.gl/1pv2Zt)
>>
>> Just a guess.
>>
>> Glenn Waldron
>>
>> On Fri, Oct 21, 2016 at 9:36 AM, Bruno Oliveira <
>> bruno.manata.olive...@gmail.com> wrote:
>>
>>> Thanks for the answer.
>>>
>>> Using GL_LUMINANCE8UI yields undefined symbol. The closest symbols I
>>> have defined is GL_LUMINANCE8UI_EXT.
>>>
>>> However, using internal TExture Format as GL_LUMINANCE8UI_EXT and pixel
>>> format GL_LUMINANCE yields  'invalid operation' errors
>>>
>>> 2016-10-21 14:03 GMT+01:00 Sebastian Messerschmidt <
>>> sebastian.messerschm...@gmx.de>:
>>>
>>>> Hi Bruno,
>>>>
>>>>
>>>>
>>>>
>>>> How do I guarantee that my textures will be unsigned integer 8bit texels
>>>>> with no scaling nor normalization to float or whatsoever? Because using
>>>>> GL_LUMINANCE is distupring my textures
>>>>>
>>>>
>>>> GL_LUMINANCE8UI should do the trick. You need use a the correct
>>>> sampler/data-type in the shader too (usampler and uvec)
>>>>
>>>> Cheers
>>>> Sebatian
>>>>
>>>>
>>>>> 2016-10-21 13:47 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>>>>> <mailto:gwald...@gmail.com>>:
>>>>>
>>>>> I mean that GL_LUMINANCE is a valid pixel format, and GL_LUMINANCE8
>>>>> is an internal format. GL_LUMINANCE8 is not a valid pixel format
>>>>> and
>>>>> will probably give you a invalid enumerant error.
>>>>>
>>>>>
>>>>>
>>>>> Glenn Waldron
>>>>>
>>>>> On Fri, Oct 21, 2016 at 8:03 AM, Bruno Oliveira
>>>>> <bruno.manata.olive...@gmail.com
>>>>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>>>>
>>>>> Sorry Glenn what do you mean by "those reserved"?
>>>>>
>>>>>
>>>>> By the way, my intention is to pass uchar textures of fixed
>>>>> size, to perform texelFetch and bitwise operations inside a
>>>>> shader, so I really need my textures to be in the exact format
>>>>> of unsigned byte integer, single channel!
>>>>>
>>>>> 2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>>>>> <mailto:gwald...@gmail.com>>:
>>>>>
>>>>> Bruno, I think you have those reversed.
>>>>>
>>>>>
>>>>> On Oct 21, 2016 6:07 AM, "Bruno Oliveira"
>>>>> <bruno.manata.olive...@gmail.com
>>>>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> thank you for your answer. I am indeed using the same
>>>>> texture sizes and formats.
>>>>> If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE
>>>>> as internalFormat, I get a "invalid enumerant" error
>>>>>
>>>>> 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt
>>>>> <sebastian.messerschm...@gmx.de
>>>>> <mailto:sebastian.messerschm...@gmx.de>>:
>>>>>
>>>>>
>>>>>
>>>>> Hi Bruno:
>>>>> Sorry for not reading to the end:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I'm trying to create a Texture2DArray. My
>>>>> textures are uchar images with
>>>>> size (texWidth,

Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
Thanks. However, I am already doing that!

2016-10-21 14:51 GMT+01:00 Glenn Waldron <gwald...@gmail.com>:

> Bruno,
> According to this thread you might also need to set your packing to 1 (in
> the image->setImage call).
> (https://goo.gl/1pv2Zt)
>
> Just a guess.
>
> Glenn Waldron
>
> On Fri, Oct 21, 2016 at 9:36 AM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> Thanks for the answer.
>>
>> Using GL_LUMINANCE8UI yields undefined symbol. The closest symbols I have
>> defined is GL_LUMINANCE8UI_EXT.
>>
>> However, using internal TExture Format as GL_LUMINANCE8UI_EXT and pixel
>> format GL_LUMINANCE yields  'invalid operation' errors
>>
>> 2016-10-21 14:03 GMT+01:00 Sebastian Messerschmidt <
>> sebastian.messerschm...@gmx.de>:
>>
>>> Hi Bruno,
>>>
>>>
>>>
>>>
>>> How do I guarantee that my textures will be unsigned integer 8bit texels
>>>> with no scaling nor normalization to float or whatsoever? Because using
>>>> GL_LUMINANCE is distupring my textures
>>>>
>>>
>>> GL_LUMINANCE8UI should do the trick. You need use a the correct
>>> sampler/data-type in the shader too (usampler and uvec)
>>>
>>> Cheers
>>> Sebatian
>>>
>>>
>>>> 2016-10-21 13:47 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>>>> <mailto:gwald...@gmail.com>>:
>>>>
>>>> I mean that GL_LUMINANCE is a valid pixel format, and GL_LUMINANCE8
>>>> is an internal format. GL_LUMINANCE8 is not a valid pixel format and
>>>> will probably give you a invalid enumerant error.
>>>>
>>>>
>>>>
>>>> Glenn Waldron
>>>>
>>>> On Fri, Oct 21, 2016 at 8:03 AM, Bruno Oliveira
>>>> <bruno.manata.olive...@gmail.com
>>>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>>>
>>>> Sorry Glenn what do you mean by "those reserved"?
>>>>
>>>>
>>>> By the way, my intention is to pass uchar textures of fixed
>>>> size, to perform texelFetch and bitwise operations inside a
>>>> shader, so I really need my textures to be in the exact format
>>>> of unsigned byte integer, single channel!
>>>>
>>>> 2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>>>> <mailto:gwald...@gmail.com>>:
>>>>
>>>> Bruno, I think you have those reversed.
>>>>
>>>>
>>>> On Oct 21, 2016 6:07 AM, "Bruno Oliveira"
>>>> <bruno.manata.olive...@gmail.com
>>>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> thank you for your answer. I am indeed using the same
>>>> texture sizes and formats.
>>>> If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE
>>>> as internalFormat, I get a "invalid enumerant" error
>>>>
>>>> 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt
>>>> <sebastian.messerschm...@gmx.de
>>>> <mailto:sebastian.messerschm...@gmx.de>>:
>>>>
>>>>
>>>>
>>>> Hi Bruno:
>>>> Sorry for not reading to the end:
>>>>
>>>> Hello,
>>>>
>>>> I'm trying to create a Texture2DArray. My
>>>> textures are uchar images with
>>>> size (texWidth, 256), single channel. The
>>>> combination of texture
>>>> internalFormat and pixelFormat with pixelType is
>>>> not working. I use
>>>> GL_R8UI for internalFormat, GL_RED_INTEGER for
>>>> pixelFormat and
>>>> GL_UNSIGNED_BYTE for type. This yields the
>>>> following error when I try to
>>>> render my scene:
>>>>
>>>> /Warning: detected OpenGL error 'invalid
>>>> 

Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
Thanks for the answer.

Using GL_LUMINANCE8UI yields undefined symbol. The closest symbols I have
defined is GL_LUMINANCE8UI_EXT.

However, using internal TExture Format as GL_LUMINANCE8UI_EXT and pixel
format GL_LUMINANCE yields  'invalid operation' errors

2016-10-21 14:03 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Hi Bruno,
>
>
>
>
> How do I guarantee that my textures will be unsigned integer 8bit texels
>> with no scaling nor normalization to float or whatsoever? Because using
>> GL_LUMINANCE is distupring my textures
>>
>
> GL_LUMINANCE8UI should do the trick. You need use a the correct
> sampler/data-type in the shader too (usampler and uvec)
>
> Cheers
> Sebatian
>
>
>> 2016-10-21 13:47 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>> <mailto:gwald...@gmail.com>>:
>>
>> I mean that GL_LUMINANCE is a valid pixel format, and GL_LUMINANCE8
>> is an internal format. GL_LUMINANCE8 is not a valid pixel format and
>> will probably give you a invalid enumerant error.
>>
>>
>>
>> Glenn Waldron
>>
>> On Fri, Oct 21, 2016 at 8:03 AM, Bruno Oliveira
>> <bruno.manata.olive...@gmail.com
>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>
>> Sorry Glenn what do you mean by "those reserved"?
>>
>>
>> By the way, my intention is to pass uchar textures of fixed
>> size, to perform texelFetch and bitwise operations inside a
>> shader, so I really need my textures to be in the exact format
>> of unsigned byte integer, single channel!
>>
>> 2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwald...@gmail.com
>> <mailto:gwald...@gmail.com>>:
>>
>> Bruno, I think you have those reversed.
>>
>>
>> On Oct 21, 2016 6:07 AM, "Bruno Oliveira"
>> <bruno.manata.olive...@gmail.com
>> <mailto:bruno.manata.olive...@gmail.com>> wrote:
>>
>> Hello,
>>
>> thank you for your answer. I am indeed using the same
>> texture sizes and formats.
>> If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE
>> as internalFormat, I get a "invalid enumerant" error
>>
>> 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt
>> <sebastian.messerschm...@gmx.de
>> <mailto:sebastian.messerschm...@gmx.de>>:
>>
>>
>>
>> Hi Bruno:
>> Sorry for not reading to the end:
>>
>> Hello,
>>
>> I'm trying to create a Texture2DArray. My
>> textures are uchar images with
>> size (texWidth, 256), single channel. The
>> combination of texture
>> internalFormat and pixelFormat with pixelType is
>> not working. I use
>> GL_R8UI for internalFormat, GL_RED_INTEGER for
>> pixelFormat and
>> GL_UNSIGNED_BYTE for type. This yields the
>> following error when I try to
>> render my scene:
>>
>> /Warning: detected OpenGL error 'invalid
>> enumerant' at after
>> RenderBin::draw(..)/
>>
>> However, if I use GL_LUMINANCE for
>> internalFormat and also GL_LUMINANCE
>> for pixelFormat, I get no errors but my textures
>> are not correctly
>> sized. WHat formats should I use here?
>>
>> When using GL_LUMINCANE as internal formet the
>> pixlel format needs to be
>> GL_LUMINANCE4/8/12/16[F/I/UI] ...
>>
>> So basically for default precision (GL_BYTE) it
>> should be
>>
>> GL_LUMINANCE8
>>
>>
>> Cheers
>> Sebastian
>>
>>
>> This is my code:
>>
>>
>>
>> osg::ref_ptr texture = new
>> osg::Texture2DArray;
>> texture->setFilter(osg

Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
How do I guarantee that my textures will be unsigned integer 8bit texels
with no scaling nor normalization to float or whatsoever? Because using
GL_LUMINANCE is distupring my textures

2016-10-21 13:47 GMT+01:00 Glenn Waldron <gwald...@gmail.com>:

> I mean that GL_LUMINANCE is a valid pixel format, and GL_LUMINANCE8 is an
> internal format. GL_LUMINANCE8 is not a valid pixel format and will
> probably give you a invalid enumerant error.
>
>
>
> Glenn Waldron
>
> On Fri, Oct 21, 2016 at 8:03 AM, Bruno Oliveira <
> bruno.manata.olive...@gmail.com> wrote:
>
>> Sorry Glenn what do you mean by "those reserved"?
>>
>>
>> By the way, my intention is to pass uchar textures of fixed size, to
>> perform texelFetch and bitwise operations inside a shader, so I really need
>> my textures to be in the exact format of unsigned byte integer, single
>> channel!
>>
>> 2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwald...@gmail.com>:
>>
>>> Bruno, I think you have those reversed.
>>>
>>> On Oct 21, 2016 6:07 AM, "Bruno Oliveira" <bruno.manata.oliveira@gmail.c
>>> om> wrote:
>>>
>>>> Hello,
>>>>
>>>> thank you for your answer. I am indeed using the same texture sizes and
>>>> formats.
>>>> If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE as
>>>> internalFormat, I get a "invalid enumerant" error
>>>>
>>>> 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt <
>>>> sebastian.messerschm...@gmx.de>:
>>>>
>>>>>
>>>>> Hi Bruno:
>>>>> Sorry for not reading to the end:
>>>>>
>>>>> Hello,
>>>>>>
>>>>>> I'm trying to create a Texture2DArray. My textures are uchar images
>>>>>> with
>>>>>> size (texWidth, 256), single channel. The combination of texture
>>>>>> internalFormat and pixelFormat with pixelType is not working. I use
>>>>>> GL_R8UI for internalFormat, GL_RED_INTEGER for pixelFormat and
>>>>>> GL_UNSIGNED_BYTE for type. This yields the following error when I try
>>>>>> to
>>>>>> render my scene:
>>>>>>
>>>>>> /Warning: detected OpenGL error 'invalid enumerant' at after
>>>>>> RenderBin::draw(..)/
>>>>>>
>>>>>> However, if I use GL_LUMINANCE for internalFormat and also
>>>>>> GL_LUMINANCE
>>>>>> for pixelFormat, I get no errors but my textures are not correctly
>>>>>> sized. WHat formats should I use here?
>>>>>>
>>>>> When using GL_LUMINCANE as internal formet the pixlel format needs to
>>>>> be GL_LUMINANCE4/8/12/16[F/I/UI] ...
>>>>>
>>>>> So basically for default precision (GL_BYTE) it should be
>>>>>
>>>>> GL_LUMINANCE8
>>>>>
>>>>>
>>>>> Cheers
>>>>> Sebastian
>>>>>
>>>>>
>>>>>> This is my code:
>>>>>>
>>>>>>
>>>>>>
>>>>>> osg::ref_ptr texture = new osg::Texture2DArray;
>>>>>> texture->setFilter(osg::Texture2DArray::MIN_FILTER,
>>>>>> osg::Texture2DArray::LINEAR);
>>>>>> texture->setFilter(osg::Texture2DArray::MAG_FILTER,
>>>>>> osg::Texture2DArray::LINEAR);
>>>>>> texture->setWrap(osg::Texture2DArray::WRAP_R,
>>>>>> osg::Texture2DArray::REPEAT);
>>>>>>  texture->setInternalFormat(*textureFormat()*);
>>>>>>
>>>>>>
>>>>>> // Add some images as follows:
>>>>>> for (...) {
>>>>>>
>>>>>>  osg::Image* image = new osg::Image;
>>>>>> image->setImage(texWidth, 256, 1, *textureFormat(), pixelFormat(),
>>>>>> type(),* dataPtr);
>>>>>>
>>>>>> texture->setImage(i, image);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> I am using:
>>>>>> textureFormat() = GL_R8UI;
>>>>>> pixelFormat() = GL_RED_INTEGER;
>>>>>> type() = GL_UNSIGNED_BYTE
>>>>>>
>>>>>>
>>>>>> ___
>>>>>> osg-users mailing list
>>>>>> osg-users@lists.openscenegraph.org
>>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>>>> cenegraph.org
>>>>>>
>>>>>> ___
>>>>> osg-users mailing list
>>>>> osg-users@lists.openscenegraph.org
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>>> cenegraph.org
>>>>>
>>>>
>>>>
>>>> ___
>>>> osg-users mailing list
>>>> osg-users@lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>> cenegraph.org
>>>>
>>>>
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>> cenegraph.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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
Sorry Glenn what do you mean by "those reserved"?


By the way, my intention is to pass uchar textures of fixed size, to
perform texelFetch and bitwise operations inside a shader, so I really need
my textures to be in the exact format of unsigned byte integer, single
channel!

2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwald...@gmail.com>:

> Bruno, I think you have those reversed.
>
> On Oct 21, 2016 6:07 AM, "Bruno Oliveira" <bruno.manata.olive...@gmail.com>
> wrote:
>
>> Hello,
>>
>> thank you for your answer. I am indeed using the same texture sizes and
>> formats.
>> If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE as internalFormat,
>> I get a "invalid enumerant" error
>>
>> 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt <
>> sebastian.messerschm...@gmx.de>:
>>
>>>
>>> Hi Bruno:
>>> Sorry for not reading to the end:
>>>
>>> Hello,
>>>>
>>>> I'm trying to create a Texture2DArray. My textures are uchar images with
>>>> size (texWidth, 256), single channel. The combination of texture
>>>> internalFormat and pixelFormat with pixelType is not working. I use
>>>> GL_R8UI for internalFormat, GL_RED_INTEGER for pixelFormat and
>>>> GL_UNSIGNED_BYTE for type. This yields the following error when I try to
>>>> render my scene:
>>>>
>>>> /Warning: detected OpenGL error 'invalid enumerant' at after
>>>> RenderBin::draw(..)/
>>>>
>>>> However, if I use GL_LUMINANCE for internalFormat and also GL_LUMINANCE
>>>> for pixelFormat, I get no errors but my textures are not correctly
>>>> sized. WHat formats should I use here?
>>>>
>>> When using GL_LUMINCANE as internal formet the pixlel format needs to be
>>> GL_LUMINANCE4/8/12/16[F/I/UI] ...
>>>
>>> So basically for default precision (GL_BYTE) it should be
>>>
>>> GL_LUMINANCE8
>>>
>>>
>>> Cheers
>>> Sebastian
>>>
>>>
>>>> This is my code:
>>>>
>>>>
>>>>
>>>> osg::ref_ptr texture = new osg::Texture2DArray;
>>>> texture->setFilter(osg::Texture2DArray::MIN_FILTER,
>>>> osg::Texture2DArray::LINEAR);
>>>> texture->setFilter(osg::Texture2DArray::MAG_FILTER,
>>>> osg::Texture2DArray::LINEAR);
>>>> texture->setWrap(osg::Texture2DArray::WRAP_R,
>>>> osg::Texture2DArray::REPEAT);
>>>>  texture->setInternalFormat(*textureFormat()*);
>>>>
>>>>
>>>> // Add some images as follows:
>>>> for (...) {
>>>>
>>>>  osg::Image* image = new osg::Image;
>>>> image->setImage(texWidth, 256, 1, *textureFormat(), pixelFormat(),
>>>> type(),* dataPtr);
>>>>
>>>> texture->setImage(i, image);
>>>> }
>>>>
>>>>
>>>> I am using:
>>>> textureFormat() = GL_R8UI;
>>>> pixelFormat() = GL_RED_INTEGER;
>>>> type() = GL_UNSIGNED_BYTE
>>>>
>>>>
>>>> ___
>>>> osg-users mailing list
>>>> osg-users@lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>> cenegraph.org
>>>>
>>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>> cenegraph.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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Creating Texture2DArray

2016-10-21 Thread Bruno Oliveira
Hello,

thank you for your answer. I am indeed using the same texture sizes and
formats.
If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE as internalFormat, I
get a "invalid enumerant" error

2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

>
> Hi Bruno:
> Sorry for not reading to the end:
>
> Hello,
>>
>> I'm trying to create a Texture2DArray. My textures are uchar images with
>> size (texWidth, 256), single channel. The combination of texture
>> internalFormat and pixelFormat with pixelType is not working. I use
>> GL_R8UI for internalFormat, GL_RED_INTEGER for pixelFormat and
>> GL_UNSIGNED_BYTE for type. This yields the following error when I try to
>> render my scene:
>>
>> /Warning: detected OpenGL error 'invalid enumerant' at after
>> RenderBin::draw(..)/
>>
>> However, if I use GL_LUMINANCE for internalFormat and also GL_LUMINANCE
>> for pixelFormat, I get no errors but my textures are not correctly
>> sized. WHat formats should I use here?
>>
> When using GL_LUMINCANE as internal formet the pixlel format needs to be
> GL_LUMINANCE4/8/12/16[F/I/UI] ...
>
> So basically for default precision (GL_BYTE) it should be
>
> GL_LUMINANCE8
>
>
> Cheers
> Sebastian
>
>
>> This is my code:
>>
>>
>>
>> osg::ref_ptr texture = new osg::Texture2DArray;
>> texture->setFilter(osg::Texture2DArray::MIN_FILTER,
>> osg::Texture2DArray::LINEAR);
>> texture->setFilter(osg::Texture2DArray::MAG_FILTER,
>> osg::Texture2DArray::LINEAR);
>> texture->setWrap(osg::Texture2DArray::WRAP_R,
>> osg::Texture2DArray::REPEAT);
>>  texture->setInternalFormat(*textureFormat()*);
>>
>>
>> // Add some images as follows:
>> for (...) {
>>
>>  osg::Image* image = new osg::Image;
>> image->setImage(texWidth, 256, 1, *textureFormat(), pixelFormat(),
>> type(),* dataPtr);
>>
>> texture->setImage(i, image);
>> }
>>
>>
>> I am using:
>> textureFormat() = GL_R8UI;
>> pixelFormat() = GL_RED_INTEGER;
>> type() = GL_UNSIGNED_BYTE
>>
>>
>> ___
>> 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


[osg-users] Creating Texture2DArray

2016-10-20 Thread Bruno Oliveira
Hello,

I'm trying to create a Texture2DArray. My textures are uchar images with
size (texWidth, 256), single channel. The combination of texture
internalFormat and pixelFormat with pixelType is not working. I use GL_R8UI
for internalFormat, GL_RED_INTEGER for pixelFormat and GL_UNSIGNED_BYTE for
type. This yields the following error when I try to render my scene:

*Warning: detected OpenGL error 'invalid enumerant' at after
RenderBin::draw(..)*

However, if I use GL_LUMINANCE for internalFormat and also GL_LUMINANCE for
pixelFormat, I get no errors but my textures are not correctly sized. WHat
formats should I use here?

This is my code:



osg::ref_ptr texture = new osg::Texture2DArray;
texture->setFilter(osg::Texture2DArray::MIN_FILTER,
osg::Texture2DArray::LINEAR);
texture->setFilter(osg::Texture2DArray::MAG_FILTER,
osg::Texture2DArray::LINEAR);
texture->setWrap(osg::Texture2DArray::WRAP_R, osg::Texture2DArray::REPEAT);
 texture->setInternalFormat(*textureFormat()*);


// Add some images as follows:
for (...) {

 osg::Image* image = new osg::Image;
image->setImage(texWidth, 256, 1, *textureFormat(), pixelFormat(), type(),*
dataPtr);

texture->setImage(i, image);
}


I am using:
textureFormat() = GL_R8UI;
pixelFormat() = GL_RED_INTEGER;
type() = GL_UNSIGNED_BYTE
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Creating HUD with trihedron and trackball sphere

2016-09-18 Thread Bruno Oliveira
Hello,

I have a 3D model viewer using a TrackballManipulator for manipulating my
view with the mouse.

I created a custom HUD that has a simple sphere representing a trackball,
but this is extremely painful, and I'm almost sure something like this
already exists anywhere.

The idea is to have a trackball similar to this one

url



like in Blender, Catia, etc. I would also like to be able to select an axis
to lock and only rotate about that axis, with the mouse.

Does anyone know anything similar to this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can't update my projection matrix amnually

2016-09-15 Thread Bruno Oliveira
I see. That means I need to manually keep updating my near/far plane.

Is there no other way?
 - Can I manually trigger a culling traversal?
 - I know the delta in z in which I am moving my camera. Can I calculate the 
new near and far planes the traversal will assign after the traversal? Example: 
newFarValue = oldFarValue + deltaZ
 - Is the near/far plane update code centralized in some public function that I 
can somehow use? If not, could you please tell me where this code is so that I 
can reproduce it?

> On 15 Sep 2016, at 17:09, Robert Osfield <robert.osfi...@gmail.com> wrote:
> 
> On 15 September 2016 at 16:57, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
>> Hello,
>> 
>> I just verified and it is indeed related to near and far planes.
>> I am zooming my camera, and therefore, somewhere along the OSG update loops, 
>> the near and far planes will change but I don’t know what the new value is 
>> going to be.
>> 
>> I need to reproduce that in my code, as in:
>> 
>>>> camera->setViewMatrix(getInverseMatrix());
>>>> camera->setProjectionMatrixAsPerspective(...);
>> 
>> 
>> Can I somehow trigger the near/far plane recalculation?
> 
> You can't manually force a compute of the near/far planes, it happens
> as part of the cull traversal as this is where the OSG can determine
> what objects are in the view frustum and hence what values would be
> appropriate to clamp the near and far planes so all objects are
> visible.
> 
> If you don't want this computation simple switch it off as per my
> previous email.
> 
> Robert.
> ___
> 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] Can't update my projection matrix amnually

2016-09-15 Thread Bruno Oliveira
Hello,


I am trying to set my view and projection camera matrix. I do this inside a
custom camera manipulator code I am building.

I set the camera view matrix as

camera->setViewMatrix(getInverseMatrix());

After this, since I am using a perspective projection matrix, I know I need
to update my projection matrix. I try to do this with

camera->setProjectionMatrixAsPerspective(30.f, aspectRatio, 0.5f, 500.f);

This results in the following projection matrix,

2.69691 0 0 0

0 3.73205 0 0

0 0 -1.002 -1

0 0 -1.001 0

However this is wrong, my matrix should be something similar to

2.69691 0 0 0

0 3.73205 0 0

0 0 -50 -1

0 0 -1.01309e+06 0


What am I doing wrong? What else do I need to correctly compute the
projection matrix?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Perspective Projection updateCamera does not work anymore

2016-09-15 Thread Bruno Oliveira
Hello,



I have a scene and I am using a Perspective Projection. I was using a Ortho
projection before.

Now, I am creating a new camera manipulator, in which I need to update the
camera zoom, and update the camera in that precise moment, in order to
check my scene for intersections of a ray from the mouse (in a way similar
to setCenterByMousePointerIntersection) . In Ortho mode, I used

camera->setViewMatrix(getInverseMatrix());

But this does not work in Perspective projection mode?
I get successful scene intersections before I set the Camera's view matrix,
but after that line of code, intersecting
Is this the problem?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD range for 2D image tiles

2016-09-14 Thread Bruno Oliveira
Sorry, my mistake. No FOV in Ortho2D projection, obviously!

I tried that setRange(id, 0.5, 2) and it did not work, no tile is ever
rendered..

Notice that my tiles are added to the scene graph as geodes, with size =
tileSize / scale,
hence, a tile is always 256 pixels, but the geode size is set to world
coordinates as the size that tile occupies in the whole image frame
coordinates.

2016-09-14 10:41 GMT+01:00 Valerian Merkling :

>
> > I am also using an Ortho2D projection (field of view 30 degrees)
>
>
> There is no such things as field of view for Ortho projection.
>
>
>
> >
> > So, Let me draw a specific scenario: an image pyramid, starting at scale
> 0.125, going all the way up to 0.25, 0.5, 1.0.I am also using an Ortho2D
> projection (field of view 30 degrees). The tiles are fixed size, and I know
> their size in pixels.
> > Can I use PIXEL_SIZE_ON_SCREEN for my purpose?
>
>
> I think you can try somethings like setRange(id, 0.5, 2); for every tiles.
>
> I mean you already have tile for each resolution level so you just need to
> show the one which is the closest to 1:1.
>
> You need ranges of [0..A], [A..B], [B..C] when using the DISTANCE_FROM_EYE.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68601#68601
>
>
>
>
>
> ___
> 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] PagedLOD range for 2D image tiles

2016-09-14 Thread Bruno Oliveira
Thank you for the answers.

So, Let me draw a specific scenario: an image pyramid, starting at scale
0.125, going all the way up to 0.25, 0.5, 1.0.
I am also using an Ortho2D projection (field of view 30 degrees). The tiles
are fixed size, and I know their size in pixels.
Can I use PIXEL_SIZE_ON_SCREEN for my purpose?

The first level (scale = 0.125), I should setRange(id, 0, A);
Second level (scale = 0.25), setRange(id, A, B); and so on,
and on Last Level (scale = 1.0, hence original image size), setRange(id, X,
FLT_MAX);

For one texel being 1 pixel on screen, how do I calculate A, B, and so on?
Or am I thinking this the wrong way?


2016-09-14 8:38 GMT+01:00 Valerian Merkling :

> Hi Bruno,
>
> I recently had the same thing to do !
>
> To solve this, I first used a Ortho2D projection matrix for my camera.
>
> I also change the Z value of the camera when I move it, to make it work
> almost as a perspective camera
> - eyepoint Z = 100 for a 1:1 zoom ratio
> - eyepoint Z = 1000 for a 1:10 ratio
>
> With this you can use the DISTANCE_FROM_EYE point configuration of the
> pagedLOD.
>
> I also made my own LOD class, derivated from pagedLOD, and changed the
> traverse function a bit to only use the Z value of the eye point and not
> this position.
>
>
> I hope this can help you and give you ideas !
>
> Valerian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68599#68599
>
>
>
>
>
> ___
> 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] PagedLOD range for 2D image tiles

2016-09-13 Thread Bruno Oliveira
Hello,

I have a pagedLOD engine setup, for displaying big images (1x1
pixels)

I subdivided these images in an pyramid with several scales (starting, for
instance, at 0.125 of the image size and going up to 1.0 of the image size)

Everything is displaying correctly, except that I don't understand how to
setup the PagedLod range for my pyramid, so that only a certain pyramid
scale appears at a time.

For now, I have this,

lod->setRangeMode(osg::LOD::RangeMode::PIXEL_SIZE_ON_SCREEN);
lod->setRange(0, 0, FLT_MAX);

So obviously all tiles display at once. How can I setup this so that only a
certain pyramid level is displayed at a time?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Invalid Operation after applying attribute Viewport

2016-09-12 Thread Bruno Oliveira
Hello, I am getting the following error in an OSG viewer, with a
osgViewer::GraphisWindowEmbedded into a QOpenGLWidget:


detected OpenGL error 'invalid operation' after applying attribute Viewport
0x7f93fbe97170



I get this error every time I call QOpenGLWidget::update(). This happens
only under MacOS X (I have Qt 5.7 and OSG 3.4). This does not happen under
Linux. I know this is insufficient information for any debug. But how can I
get more details to debug this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trigger some function when PagedLOD finishes openening a node

2016-09-12 Thread Bruno Oliveira
Hello Robert,

thank you very much for the detailed answer. I implemented an app based on
Qt. My draw/frame events are only called when the user makes some action
(e.g. Mouse Click, Mouse Move). Is there a way I could bypass this and use
the osgViewer:::ViewerBase::ON_DEMAND option?

2016-09-10 17:36 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> You could possible use the ReadFileCllback for this purpose.  Have a
> look through the archives for discussions on the different ways that
> ReadFileCallback can be used.
>
> However, I have to add the the DatabasePager is designed to dispatch
> compile operations to the draw traversal to compile the newly loaded
> subgraphs incrementally during each frame.  A newly loaded subgraph
> isn't merged until all the GL objects in that subgraph have been
> compiled.  This means you can't just switch off doing the rendering
> loop and wait for things to load and just render one frame and expect
> everything to merge right away.  This incremental compilation exists
> to avoid frame drops.
>
> One way around this pre compilation would be to simply switch off pre
> compilation of subgraphs, this would be new subgraphs are merged in
> the frame right after it has been loaded. However, this approach
> increases the changes of a frame drop as the new data is rendered for
> the first time.
>
> There is support built into lazy update of the scene via the
> osgViewer::ViewerBase::setRunFrameScheme(...) support for the the
> osgViewer:::ViewerBase::ON_DEMAND option.  When this is set and you
> use the Viewer::run() method the viewer will automatically only call
> frame when events have happened, there are animations running or the
> database requires a new frame to be done (including for the
> incremental compilation.)   You could have a look at how this is
> implemented if you want to do something similar, or just use it
> directly.
>
> Robert.
>
> On 10 September 2016 at 09:56, Bruno Oliveira
> <bruno.manata.olive...@gmail.com> wrote:
> > Hello,
> >
> >
> > I am using a PagedLOD engine, but I need to call some function I have
> every
> > time the PagedLOD finished reading a Node and it is ready for rendering.
> > This function I want to call is intended to trigger a draw/refresh
> action in
> > my viewer, but I think this could be any function at all.
> >
> >
> > How do I do that?
> >
> > Thank you
> >
> > ___
> > 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


[osg-users] Trigger some function when PagedLOD finishes openening a node

2016-09-10 Thread Bruno Oliveira
Hello,


I am using a PagedLOD engine, but I need to call some function I have every
time the PagedLOD finished reading a Node and it is ready for rendering.
This function I want to call is intended to trigger a draw/refresh action
in my viewer, but I think this could be any function at all.


How do I do that?

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


[osg-users] Allocating osg::image from my own data buffer

2016-08-22 Thread Bruno Oliveira
Hello,

the following code block is creating an image from a buffer I own. This
does not allocate a new buffer, but assumes my buffer will not be
deallocated. How do I create a new, independent osg::Image copying data
from my buffer to an internal array?

osg::Image img = osg::image();
img->setImage(
  width,
  height,
  1,
  internalTextureFormat(),
  type(),
  MyDataBuffer(),
  osg::Image::NO_DELETE);
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] undeclared identifier for Glenum's in OSX

2016-07-28 Thread Bruno Oliveira
Hello,

with OSG 3.4.0 from git, under OSX El Capitan, I am getting the following
undeclared OpenGL identifiers (GLEnums actually). This does not happen
under Linux Ubuntu nor Windows:

 error: use of undeclared identifier 'GL_RGBA8UI'

return GL_RGBA8UI;

   ^

 error: use of undeclared identifier 'GL_RGBA16UI'

return GL_RGBA16UI;

   ^

 error: use of undeclared identifier 'GL_RGBA32F'

return GL_RGBA32F;

   ^

 error: use of undeclared identifier 'GL_RGB8UI'

return GL_RGB8UI;

   ^

 error: use of undeclared identifier 'GL_RGB16UI'

return GL_RGB16UI;

   ^

 error: use of undeclared identifier 'GL_RGB32F'

return GL_RGB32F;




These are the headers I include in this .cpp:


  #include 


  #include 


  #include 



  #include 


  #include 



  #include 


  #include 


  #include 


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


Re: [osg-users] Implement tile-based, large scale 2d map rendering

2016-07-28 Thread Bruno Oliveira
Hello,

I've been investigating that source code but can't seem to find where the
2D tiled/LOD image rendering is handled. Can you give me some insight
please?
Thank you

2016-07-06 9:43 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Am 06.07.2016 um 10:31 schrieb Christian Buchner:
>
> Isn't OsgEarth focused on meshed 3D terrain mostly? That might incur some
> unnecessary overhead when displaying this in a 2D projection top view.
>
> That's only half the truth. It can be used for tile based map-projections
> too.
>
> Cheers
> Sebastian
>
>
>
> 2016-07-05 23:33 GMT+02:00 Jason Beverage <jasonbever...@gmail.com>:
>
>> Check out http://www.osgearth.org, it likely does everything you're
>> trying to do.
>>
>> Jason
>>
>> On Tue, Jul 5, 2016, 5:18 AM Bruno Oliveira <
>> bruno.manata.olive...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>>
>>> can someone give me some hints on where to start implementing a
>>> tile-based, large scale 2d map renderer? This is similar to, for instance,
>>> Google maps, i.e., it only shows the visible tiles, and increases scale as
>>> I zoom in.
>>>
>>> I have a large tiled 2d raster map (e.g. 200k x 200k pixels) stored in
>>> hard disk. Can I add these tiles to a PagedLOD engine?
>>> ___
>>> 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 
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to render 16bit depth image

2016-07-20 Thread Bruno Oliveira
That did the trick. Thank you :)

2016-07-20 11:56 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Hi Bruno,
>
> I intend to render a 16 bit per channel, 4 channel image, i.e., each pixel
> is 4 x unsigned 16bit (uint16_t) RGBA, leading to 64bit per pixel.
>
> This clarified you probably need:
> internal: GL_RGBA16UI
> format: GL_RGBA
> type: GL_UNSIGNED_SHORT
>
>
> https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glTexImage2D.xml
>
> Hope that helps
> Cheers
> Sebastian
>
>
> 2016-07-20 8:48 GMT+01:00 Sebastian Messerschmidt <
> sebastian.messerschm...@gmx.de>:
>
>> Hi Bruno,
>>
>> Ok so I meant GL_ vars. Could you suggest any code for substituting that
>> setImage line? Thank you
>>
>>
>> To what end? You haven't told us, what you want to achieve, except from
>> using integer.
>> If you want to fill it with 16bit integer values you probably need
>>
>>
>> internal: GL_R16UI
>> format: GL_RED_INTEGER
>> type: GL_UNSIGNED_SHORT
>>
>> will give you a format, where the red channel is 16bit with unsigned
>> values and your source type is unsigned short values.
>>
>> Cheers
>> Sebastian
>>
>>
>> On 19 Jul 2016, at 09:35, Sebastian Messerschmidt <
>> sebastian.messerschm...@gmx.de> wrote:
>>
>> Hi Bruno,
>>
>> Sorry but I didn't quite catch that.
>> What do you mean by "but I thing you need to use GL_RGBA_INTEGER_EXT as
>> source"
>>
>> The source type needs to be GL_RGBA_INTEGER_EXT afaik when using integer
>> textures.
>>
>> Alternatively, how can I replace the macros in that setImage function
>> call?
>>
>> Which macros? The GL_ are constants.
>>
>> Cheers
>> Sebastian
>>
>>
>> 2016-07-19 8:45 GMT+01:00 Sebastian Messerschmidt <
>> sebastian.messerschm...@gmx.de>:
>>
>>> Hi,
>>>
>>> Your internal format needs to be 16bit per channel to I think, so
>>> GL_UNSIGNED_INT_8_8_8_8_REV might be inappropriate.
>>> GL_R16UI might do, but I thing you need to use GL_RGBA_INTEGER_EXT as
>>> source. Alternatively you can use GL_LUMINANCE with GL_LUMINACE16F.
>>>
>>> What exactly are you doing with the image?
>>>
>>> Cheers
>>> Sebastian
>>>
>>> Hello,
>>>
>>> I have a 16bit per channel, 4 channel, image. The format is short
>>> (uint16_t). Note that this image is scaled to the full 16bit depth [0,
>>> 65536]
>>>
>>>
>>> I have this code that works well for a 8bit, 4 channel image:
>>>
>>> osg::ref_ptr image = new osg::Image();
>>>  image->setImage(ImageSize, ImageSize,1,
>>> GL_RGBA8,
>>> GL_RGBA,
>>> GL_UNSIGNED_INT_8_8_8_8_REV,
>>> MyDataPtr,
>>> osg::Image::NO_DELETE);
>>>
>>>
>>>
>>> Now I want to por this to 16bit depth.
>>> How is this done?
>>>
>>> I tried
>>>
>>>  image->setImage(ImageSize, ImageSize,1,
>>> GL_RGBA16UI,
>>> GL_RGBA,
>>> GL_UNSIGNED_INT_8_8_8_8_REV,
>>> MyDataPtr,
>>> osg::Image::NO_DELETE);
>>>
>>> But this yields all black textures. How can I do this without converting
>>> my 16bit image pixel data?
>>>
>>>
>>> ___
>>> 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
>>>
>>>
>>
>>
>> ___
>> 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
>>
>>
>>
>> ___
>> 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
>>
>>
>
>
> ___
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to render 16bit depth image

2016-07-20 Thread Bruno Oliveira
I intend to render a 16 bit per channel, 4 channel image, i.e., each pixel
is 4 x unsigned 16bit (uint16_t) RGBA, leading to 64bit per pixel.

2016-07-20 8:48 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Hi Bruno,
>
> Ok so I meant GL_ vars. Could you suggest any code for substituting that
> setImage line? Thank you
>
>
> To what end? You haven't told us, what you want to achieve, except from
> using integer.
> If you want to fill it with 16bit integer values you probably need
>
>
> internal: GL_R16UI
> format: GL_RED_INTEGER
> type: GL_UNSIGNED_SHORT
>
> will give you a format, where the red channel is 16bit with unsigned
> values and your source type is unsigned short values.
>
> Cheers
> Sebastian
>
>
> On 19 Jul 2016, at 09:35, Sebastian Messerschmidt <
> sebastian.messerschm...@gmx.de> wrote:
>
> Hi Bruno,
>
> Sorry but I didn't quite catch that.
> What do you mean by "but I thing you need to use GL_RGBA_INTEGER_EXT as
> source"
>
> The source type needs to be GL_RGBA_INTEGER_EXT afaik when using integer
> textures.
>
> Alternatively, how can I replace the macros in that setImage function call?
>
> Which macros? The GL_ are constants.
>
> Cheers
> Sebastian
>
>
> 2016-07-19 8:45 GMT+01:00 Sebastian Messerschmidt <
> sebastian.messerschm...@gmx.de>:
>
>> Hi,
>>
>> Your internal format needs to be 16bit per channel to I think, so
>> GL_UNSIGNED_INT_8_8_8_8_REV might be inappropriate.
>> GL_R16UI might do, but I thing you need to use GL_RGBA_INTEGER_EXT as
>> source. Alternatively you can use GL_LUMINANCE with GL_LUMINACE16F.
>>
>> What exactly are you doing with the image?
>>
>> Cheers
>> Sebastian
>>
>> Hello,
>>
>> I have a 16bit per channel, 4 channel, image. The format is short
>> (uint16_t). Note that this image is scaled to the full 16bit depth [0,
>> 65536]
>>
>>
>> I have this code that works well for a 8bit, 4 channel image:
>>
>> osg::ref_ptr image = new osg::Image();
>>  image->setImage(ImageSize, ImageSize,1,
>> GL_RGBA8,
>> GL_RGBA,
>> GL_UNSIGNED_INT_8_8_8_8_REV,
>> MyDataPtr,
>> osg::Image::NO_DELETE);
>>
>>
>>
>> Now I want to por this to 16bit depth.
>> How is this done?
>>
>> I tried
>>
>>  image->setImage(ImageSize, ImageSize,1,
>> GL_RGBA16UI,
>> GL_RGBA,
>> GL_UNSIGNED_INT_8_8_8_8_REV,
>> MyDataPtr,
>> osg::Image::NO_DELETE);
>>
>> But this yields all black textures. How can I do this without converting
>> my 16bit image pixel data?
>>
>>
>> ___
>> 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
>>
>>
>
>
> ___
> 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
>
>
>
> ___
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to render 16bit depth image

2016-07-19 Thread Bruno Oliveira
Ok so I meant GL_ vars. Could you suggest any code for substituting that 
setImage line? Thank you

> On 19 Jul 2016, at 09:35, Sebastian Messerschmidt 
>  wrote:
> 
> Hi Bruno,
>> Sorry but I didn't quite catch that.
>> What do you mean by "but I thing you need to use GL_RGBA_INTEGER_EXT as 
>> source"
> The source type needs to be GL_RGBA_INTEGER_EXT afaik when using integer 
> textures. 
>> Alternatively, how can I replace the macros in that setImage function call?
> Which macros? The GL_ are constants. 
> 
> Cheers
> Sebastian 
>> 
>> 2016-07-19 8:45 GMT+01:00 Sebastian Messerschmidt 
>> :
>>> Hi,
>>> 
>>> Your internal format needs to be 16bit per channel to I think, so 
>>> GL_UNSIGNED_INT_8_8_8_8_REV might be inappropriate. 
>>> GL_R16UI might do, but I thing you need to use GL_RGBA_INTEGER_EXT as 
>>> source. Alternatively you can use GL_LUMINANCE with GL_LUMINACE16F.
>>> 
>>> What exactly are you doing with the image? 
>>> 
>>> Cheers
>>> Sebastian
 Hello,
 
 I have a 16bit per channel, 4 channel, image. The format is short 
 (uint16_t). Note that this image is scaled to the full 16bit depth [0, 
 65536]
 
 
 I have this code that works well for a 8bit, 4 channel image:
 
 osg::ref_ptr image = new osg::Image(); 
  image->setImage(ImageSize, ImageSize,1,
 GL_RGBA8,
 GL_RGBA,
 GL_UNSIGNED_INT_8_8_8_8_REV, 
 MyDataPtr,
 osg::Image::NO_DELETE);
 
 
 
 Now I want to por this to 16bit depth.
 How is this done?
 
 I tried
 
  image->setImage(ImageSize, ImageSize,1,
 GL_RGBA16UI,
 GL_RGBA,
 GL_UNSIGNED_INT_8_8_8_8_REV, 
 MyDataPtr,
 osg::Image::NO_DELETE);
 
 But this yields all black textures. How can I do this without converting 
 my 16bit image pixel data?
 
 
 ___
 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
> 
> ___
> 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] how to render 16bit depth image

2016-07-19 Thread Bruno Oliveira
Sorry but I didn't quite catch that.
What do you mean by "but I thing you need to use GL_RGBA_INTEGER_EXT as
source"
Alternatively, how can I replace the macros in that setImage function call?

2016-07-19 8:45 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Hi,
>
> Your internal format needs to be 16bit per channel to I think, so
> GL_UNSIGNED_INT_8_8_8_8_REV might be inappropriate.
> GL_R16UI might do, but I thing you need to use GL_RGBA_INTEGER_EXT as
> source. Alternatively you can use GL_LUMINANCE with GL_LUMINACE16F.
>
> What exactly are you doing with the image?
>
> Cheers
> Sebastian
>
> Hello,
>
> I have a 16bit per channel, 4 channel, image. The format is short
> (uint16_t). Note that this image is scaled to the full 16bit depth [0,
> 65536]
>
>
> I have this code that works well for a 8bit, 4 channel image:
>
> osg::ref_ptr image = new osg::Image();
>  image->setImage(ImageSize, ImageSize,1,
> GL_RGBA8,
> GL_RGBA,
> GL_UNSIGNED_INT_8_8_8_8_REV,
> MyDataPtr,
> osg::Image::NO_DELETE);
>
>
>
> Now I want to por this to 16bit depth.
> How is this done?
>
> I tried
>
>  image->setImage(ImageSize, ImageSize,1,
> GL_RGBA16UI,
> GL_RGBA,
> GL_UNSIGNED_INT_8_8_8_8_REV,
> MyDataPtr,
> osg::Image::NO_DELETE);
>
> But this yields all black textures. How can I do this without converting
> my 16bit image pixel data?
>
>
> ___
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] how to render 16bit depth image

2016-07-18 Thread Bruno Oliveira
Hello,

I have a 16bit per channel, 4 channel, image. The format is short
(uint16_t). Note that this image is scaled to the full 16bit depth [0,
65536]


I have this code that works well for a 8bit, 4 channel image:

osg::ref_ptr image = new osg::Image();
 image->setImage(ImageSize, ImageSize,1,
GL_RGBA8,
GL_RGBA,
GL_UNSIGNED_INT_8_8_8_8_REV,
MyDataPtr,
osg::Image::NO_DELETE);



Now I want to por this to 16bit depth.
How is this done?

I tried

 image->setImage(ImageSize, ImageSize,1,
GL_RGBA16UI,
GL_RGBA,
GL_UNSIGNED_INT_8_8_8_8_REV,
MyDataPtr,
osg::Image::NO_DELETE);

But this yields all black textures. How can I do this without converting my
16bit image pixel data?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PagedLOD just keeps increasing number of LOD nodes

2016-07-12 Thread Bruno Oliveira
Hello,

I have a scene with a point cloud, ordered in an octree.
I have each node in a separate file, so I built a PagedLOD engine based
renderer.

My octree is of depth 2, with approximately 3 million points.

I found out that this engine is consuming more memory than I expected.
Hence I added a StatsHandler to my view, and found out that while
navigating through my scene, that the 'LOD' number is ALWAYS increasing and
never decreases. Does this means the PagedLOD nodes are not being deleted
correctly?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Inherithance from osg::referenced

2016-07-11 Thread Bruno Oliveira
Hello,

I am creating a class that should inherit from osg::Referenced.
Is there any guideline document available?
I searched for a while and couldn’t find any.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Implement tile-based, large scale 2d map rendering

2016-07-05 Thread Bruno Oliveira
Hello,


can someone give me some hints on where to start implementing a tile-based,
large scale 2d map renderer? This is similar to, for instance, Google maps,
i.e., it only shows the visible tiles, and increases scale as I zoom in.

I have a large tiled 2d raster map (e.g. 200k x 200k pixels) stored in hard
disk. Can I add these tiles to a PagedLOD engine?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] reset root color to original colors

2016-05-25 Thread Bruno Oliveira
Thank you very much, those hints did the job.

I will try to better explain my question the next time. I intended to
disable the shader / program.

2016-05-25 9:10 GMT+01:00 Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de>:

> Hi Bruno,
>
> Your question is a bit vague. If you use a shader you have total control
> over the colors.
> If my interpretation of your question is correct, you want to disable the
> shader. There is no real "disable" it, you have to bind a empty program
> instead. (simply don't assign any shader).
>
> Cheers
> Sebastian
>
> Hello,
>
> I have one single root node in my scene graph. I have a vertex array and a
> color array. I susually use them in conjunction to see my vertices with the
> original colors, with
>
> ret->setColorArray(m_colors);
> ret->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
>
>
> Now I am adding the option for custom shaders. This is done with
> osg::Programs, and adding the program to the stateset of the root node.
>
> osg::ref_ptr program = new osg::Program;
> program->setName(m_name);
> program->addShader(new osg::Shader(osg::Shader::VERTEX, m_vertex));
> program->addShader(new osg::Shader(osg::Shader::FRAGMENT, m_fragment));
>
> Now I want to reset this, and assign the original colors I have in the
> color Array back again. How can I do this? Do I have to create a new shader
> for applying the custom colors in the color array? Or can I reset this in a
> simpler fashion?
>
>
> ___
> 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
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] reset root color to original colors

2016-05-24 Thread Bruno Oliveira
Hello,

I have one single root node in my scene graph. I have a vertex array and a
color array. I susually use them in conjunction to see my vertices with the
original colors, with

ret->setColorArray(m_colors);
ret->setColorBinding(osg::Geometry::BIND_PER_VERTEX);


Now I am adding the option for custom shaders. This is done with
osg::Programs, and adding the program to the stateset of the root node.

osg::ref_ptr program = new osg::Program;
program->setName(m_name);
program->addShader(new osg::Shader(osg::Shader::VERTEX, m_vertex));
program->addShader(new osg::Shader(osg::Shader::FRAGMENT, m_fragment));

Now I want to reset this, and assign the original colors I have in the
color Array back again. How can I do this? Do I have to create a new shader
for applying the custom colors in the color array? Or can I reset this in a
simpler fashion?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How does PIXEL_SIZE_ON_SCREEN work

2016-05-17 Thread Bruno Oliveira
Thank you both. The problem I'm having is relative to the point clouds
density: too dense clouds will result in poor rendering performance if I
tune my LOD to render sparser clouds. I can't find a good trade-off for the
LOD resolution that fits both cases. I will probably subclass the LOD class.

Thank you once again.

2016-05-17 12:07 GMT+01:00 Robert Osfield :

> Hi Bruno,
>
> If you have some very specific metrics you'd like to use to choose LOD
> levels that aren't supported by the osg::LOD then you could subclass
> from osg::Group and implement your own Level of Detail behavior
>
> Robert.
> ___
> 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] How does PIXEL_SIZE_ON_SCREEN work

2016-05-17 Thread Bruno Oliveira
I am rendering point clouds.

What I want to do is to guarantee a certain point density is displayed. I
know the number of points in each LOD and I know the bounding boxes of
those LOD's. Can't I calculate a certain resolution value to pass to the
LOD?

2016-05-16 11:54 GMT+01:00 Bruno Oliveira <bruno.manata.olive...@gmail.com>:

> Thank you very much ! I understand very well the concept now, But I can't
> still figure out a good range value, and based on what
>
> 2016-05-16 11:13 GMT+01:00 Jordi Torres <jtorresfa...@gmail.com>:
>
>> Hi Bruno,
>>
>> Take a look to this document from Chris ( Alphapixel )
>> http://alphapixel.com/wp-content/uploads/2015/04/LOD-Level-of-detail-in-OpenSceneGraph-OSG.pdf
>> .
>> It could shed some light on LODding.
>>
>> Cheers.
>>
>> 2016-05-16 12:03 GMT+02:00 Bruno Oliveira <
>> bruno.manata.olive...@gmail.com>:
>>
>>> Hello,
>>>
>>> I am using a LOD but I don't understand how PIXEL_SIZE_ON_SCREEN range
>>> mode works.
>>>
>>>
>>> I am doing
>>>
>>> lod->setRangeMode(osg::LOD::RangeMode::PIXEL_SIZE_ON_SCREEN);
>>>
>>> but what parameters can I use to configure this mode?
>>>
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>>
>> --
>> Jordi Torres
>>
>>
>>
>> ___
>> 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] How does PIXEL_SIZE_ON_SCREEN work

2016-05-16 Thread Bruno Oliveira
Thank you very much ! I understand very well the concept now, But I can't
still figure out a good range value, and based on what

2016-05-16 11:13 GMT+01:00 Jordi Torres <jtorresfa...@gmail.com>:

> Hi Bruno,
>
> Take a look to this document from Chris ( Alphapixel )
> http://alphapixel.com/wp-content/uploads/2015/04/LOD-Level-of-detail-in-OpenSceneGraph-OSG.pdf
> .
> It could shed some light on LODding.
>
> Cheers.
>
> 2016-05-16 12:03 GMT+02:00 Bruno Oliveira <bruno.manata.olive...@gmail.com
> >:
>
>> Hello,
>>
>> I am using a LOD but I don't understand how PIXEL_SIZE_ON_SCREEN range
>> mode works.
>>
>>
>> I am doing
>>
>> lod->setRangeMode(osg::LOD::RangeMode::PIXEL_SIZE_ON_SCREEN);
>>
>> but what parameters can I use to configure this mode?
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> Jordi Torres
>
>
>
> ___
> 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] How does PIXEL_SIZE_ON_SCREEN work

2016-05-16 Thread Bruno Oliveira
Hello,

I am using a LOD but I don't understand how PIXEL_SIZE_ON_SCREEN range mode
works.


I am doing

lod->setRangeMode(osg::LOD::RangeMode::PIXEL_SIZE_ON_SCREEN);

but what parameters can I use to configure this mode?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Remove all LOD children

2016-05-13 Thread Bruno Oliveira
I checked with valgrind, and effectively I did not find any memory leak.

The OS System Monitor (Ubuntu, as I said) consistently presents double the
memory valgrind does (e.g., System Monitor says the app is using 2Gb, while
valgrind states it is 1GB).

My data (a point cloud) is actually 1GB (binary format). I thought the 2GB
came from OSG or OpenGL driver keeping a copy of my data for some reason.

2016-05-13 16:23 GMT+01:00 Alberto Luaces <alua...@udc.es>:

> I think some facts must be made clear:
>
> * You cannot control when the OpenGL driver releases the memory it
>   claimed in a previous instant.
>
> * You cannot control when the operating system claims back the memory
>   pages that a process requested, and in addition, many times it is
>   simply not possible to do it due to memory fragmentation.
>
> * At most, what you can do is to check that your program is not leaking
>   memory with a special tool, as the one I recommended (valgrind for
>   CPUs, other tools for GPUs).
>
> System memory tools are completely unreliable for this specific purpose.
>
> Bruno Oliveira writes:
>
> > I tried removing the children with m_rootNode->removeChildren(0,
> > m_rootNode->getNumChildren());
> > but this results in some memory being still allocated.
> >
> > After that, I move the mouse around a bit in the clean scene, and the
> > memory starts being freed. However, It never gets to the initial
> > value, there is always some memory floating around.
> >
> > 2016-05-13 15:16 GMT+01:00 Alberto Luaces
> > <alua...@udc.es>:
> >
> > Bruno,
> >
> > if you read the source code, you will see that the LOD uses the
> > same
> > scheme for storing nodes as a Group: just a vector of ref_ptr that
> > will
> >     be unallocated when destroyed.
> >
> > Maybe you can place some breakpoints at the destructors on the
> > debugger
> > and see what is happening.
> >
> > Bruno Oliveira writes:
> >
> > > Thank you for your answer. However, since I'm using a LOD, I
> > think it
> > > is not properly removing my data. At least the memory is still
> >     > allocated.
> > > If I manually iterate over all nodes and delete them by myself,
> > some
> > > memory is freed, but not all!
> > >
> > > 2016-05-13 14:58 GMT+01:00 Alberto Luaces
> > >
> > >
> >
> >
> > > Bruno Oliveira writes:
> > >
> > > > At some point I want to completely wipe out my scene. How can
> > I
> > > delete
> > > > all nodes?
> > >
> > > If you want to wipe a node and all its descendants, just delete
> > > the
> > > parent node. That is what reference counting is all about.
> >
> > --
> > Alberto
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> >
> >
>
> --
> Alberto
>
> ___
> 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] Remove all LOD children

2016-05-13 Thread Bruno Oliveira
I tried removing the children with m_rootNode->removeChildren(0,
m_rootNode->getNumChildren());
but this results in some memory being still allocated.

After that, I move the mouse around a bit in the clean scene, and the
memory starts being freed. However, It never gets to the initial value,
there is always some memory floating around.

2016-05-13 15:16 GMT+01:00 Alberto Luaces <alua...@udc.es>:

> Bruno,
>
> if you read the source code, you will see that the LOD uses the same
> scheme for storing nodes as a Group: just a vector of ref_ptr that will
> be unallocated when destroyed.
>
> Maybe you can place some breakpoints at the destructors on the debugger
> and see what is happening.
>
> Bruno Oliveira writes:
>
> > Thank you for your answer. However, since I'm using a LOD, I think it
> > is not properly removing my data. At least the memory is still
> > allocated.
> > If I manually iterate over all nodes and delete them by myself, some
> > memory is freed, but not all!
> >
> > 2016-05-13 14:58 GMT+01:00 Alberto Luaces
> >
> >
> > Bruno Oliveira writes:
> >
> > > At some point I want to completely wipe out my scene. How can I
> > delete
> > > all nodes?
> >
> > If you want to wipe a node and all its descendants, just delete
> > the
> > parent node. That is what reference counting is all about.
>
> --
> Alberto
>
> ___
> 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] Remove all LOD children

2016-05-13 Thread Bruno Oliveira
Thank you for your answer. However, since I'm using a LOD, I think it is
not properly removing my data. At least the memory is still allocated.
If I manually iterate over all nodes and delete them by myself, some memory
is freed, but not all!

2016-05-13 14:58 GMT+01:00 Alberto Luaces <alua...@udc.es>:

> Bruno Oliveira writes:
>
> > At some point I want to completely wipe out my scene. How can I delete
> > all nodes?
>
> If you want to wipe a node and all its descendants, just delete the
> parent node.  That is what reference counting is all about.
>
> --
> Alberto
>
> ___
> 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] Remove all LOD children

2016-05-13 Thread Bruno Oliveira
Hello,

Sorry to bother again. I think this is somwhat a different topic from my
previous post.
I am using a LOD based node, with several gourps/LODs.
At some point I want to completely wipe out my scene. How can I delete all
nodes?


This is my code. I think it still leaves some nodes floating.

void rRemoveChildren(osg::Node* currNode) {

osg::Group* currGroup;
osg::Node*  foundNode;

// check to see if we have a valid (non-NULL) node.
// if we do have a null node, return NULL.
if (!currNode) {
return;
}

currGroup = currNode->asGroup(); // returns NULL if not a group.
if (currGroup) {
auto nChildren = currGroup->getNumChildren();
for (int i = nChildren-1; i >=0; i--) {
osg::Group* asGroup = currGroup->getChild(i)->asGroup();
if (!asGroup || asGroup->getNumChildren() < 1) {
osg::Node* shild = currGroup->getChild(i);
shild->releaseGLObjects();
currGroup->removeChild(shild);


}
else rRemoveChildren(asGroup);
}
} else {
auto parents = currNode->getParents();
for (auto p : parents)
p->removeChild(currNode);
}
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
I am using Ubuntu's System monitor.
How can I measure it more accurately?

2016-05-13 13:08 GMT+01:00 Alberto Luaces <alua...@udc.es>:

> Bruno Oliveira writes:
>
> > Hello,
> >
> > thank you for your answaer. However, that does not have any effect :(
>
> One thing you are not stating is how are you measuring your memory
> consumption.  Relaying on OS stats may not be precise enough since when
> one frees some memory block, OSes tend to not returning it back
> immediately to the general memory pool.
>
> --
> Alberto
>
> ___
> 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] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
Hello,

thank you for your answaer. However, that does not have any effect :(

2016-05-13 11:13 GMT+01:00 Jannik Heller :

> Hi,
>
> There may be some memory allocations left in the graphics driver. OSG does
> all the OpenGL work from a background thread, so the memory used by OpenGL
> can not be reclaimed immediately upon removing the node from the scene. Try
> calling frame() a few times and then see if your memory usage decreases
> again.
>
> Cheers,
> Jannik
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67088#67088
>
>
>
>
>
> ___
> 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] Clear scene data and underlying memory structures

2016-05-13 Thread Bruno Oliveira
Hello,

I have spent a great deal of time trying to figure out OSG's memory
management.
I have a scene graph with several children (actually a LOD based on an
octree).

However, when I need to reset my scene (I just want to wipe ALL nodes from
de scene and also wipe the memory), I use

// Clear main osg::Group root node
m_rootNode->removeChildren(0, m_rootNode->getNumChildren());
m_rootNode->dirtyBound();

// Clear Main view scene data from osg::Viewer
m_viewer->setSceneData(nullptr);


BEFORE I do this, I check all my nodes with a NodeVisitor pattern, and
found out that ALL my nodes have reference count of 1, i.e, after clearing
them from the scene, I expect my memory to be freed. However, this does not
happen: my scene is actually reset, all the nodes disappear from the
viewer, but the memory remains occupied.

Nonetheless, when I load another scene to my viewer, the memory is
rewritten somehow (i.e., the memory usage does not increase, hence there is
no memory leak, but used memory is always the same)

I can't have this behaviour, as I need to closely control memory usage. How
can I do this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] LOD capabilities

2016-04-26 Thread Bruno Oliveira
Robert,

the tool I'm creating is designed to handle clouds from 100 million points
to 1 billion, hence the out of core rendering.
By "with the already existing code", I mean code from OSG.

Thank you

2016-04-26 9:40 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> Hi Bruno,
>
> On 26 April 2016 at 09:20, Bruno Oliveira <bruno.manata.olive...@gmail.com
> > wrote:
>
>> I am thinking of porting my code for representing a huge point cloud
>> scene from a simple osg::Group/osg::Node structure to a PagedLOD. This is
>> due to the fact that I can't
>>
>> I have built a custom octree for this purpose (I could probably publish
>> it in the future if it would be useful for the OSG lib).
>>
>> My problem is that I need to perform some cloud manipulations, e.g.
>> delete points, add more points, perform picking...
>>
>>1. Would this be possible using the OSG PagedLOD node structure? Or
>>is it better to do all these operations on my own?
>>
>> You can use PagedLOD, but you'll need to write a tool to pre-process the
> raw data into a hierachy of tiles that the PagedLOD's will reference.
>
>
>
>>
>>1.
>>2. Would this be possible without ever loading the entire cloud at
>>once (with the already existing code)?
>>
>> How long is the piece of string I have in my hand?  Please answer this
> question within 1cm of accuracy without asking any further questions.
>
> If you find this question difficult to answer then you'll understand why
> we don' have hope in hell of answering your question.
>
> Please state size of your datasets.
>
> Robert
>
> ___
> 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] LOD capabilities

2016-04-26 Thread Bruno Oliveira
Hello,

I am thinking of porting my code for representing a huge point cloud scene
from a simple osg::Group/osg::Node structure to a PagedLOD. This is due to
the fact that I can't

I have built a custom octree for this purpose (I could probably publish it
in the future if it would be useful for the OSG lib).

My problem is that I need to perform some cloud manipulations, e.g. delete
points, add more points, perform picking...

   1. Would this be possible using the OSG PagedLOD node structure? Or is
   it better to do all these operations on my own?
   2. Would this be possible without ever loading the entire cloud at once
   (with the already existing code)? How much would this affect the overall
   picking performance, etc?
   3. I still don't understand OSG Point Picking very well. Are there any
   good examples on this?

Thank you!
___
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-16 Thread Bruno Oliveira
So the best option in this case would be load the entire scene at once?

2016-04-16 9:14 GMT+01:00 Robert Osfield <robert.osfi...@gmail.com>:

> On 16 April 2016 at 08:55, Bruno Oliveira <bruno.manata.olive...@gmail.com
> > wrote:
>
>> Is it possible to perform intersection when using PagedLOD?
>
>
> It will work fine for the already loaded tiles but won't automatically
> load the highest LOD level.
>
> You can use osgSim::LineOfSight to automatically load all the tiles
> required to get to the highest LOD level, but this is dependent on disk
> access so can be slow.
>
> ___
> 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] pick a point or line

2016-04-16 Thread Bruno Oliveira
Is it possible to perform intersection when using PagedLOD?

> On 06 Apr 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


  1   2   >