Re: [osg-users] osg::observer_ptr and osg::ref_ptr

2018-10-24 Thread Kristofer Krus
Hi Robert,

Thanks. I'm having the problem that an observer_ptr that is assigned a pointer 
to an object that hasn't yet been assigned to a ref_ptr looks like it is 
invalid when I try to lock it (but not when I call the get method, so there is 
a discrepancy between observer_ptr::lock and observer_ptr::get in that sense). 
When the pointer is also assigned to a ref_ptr so that the reference count in 
the referenced object goes up, the lock method starts to return true instead of 
false.

Here is what I do: In the constructor of a class that is referencable, I create 
an observer_ptr, obs, that is assigned the this-pointer—pointing at object A, 
which is the object being constructed—and I send obs to another object B that 
wants to observe A. at this point, it looks like obs is invalid. Directly after 
A has been constructed—by using the new-keyword—its memory address is assigned 
to a ref_ptr and obs.lock suddenly starts to succeed.

Is this desirable behavior? I mean, the object exists, right? Why would 
otherwise get() succeed? Also, if you create an obs_ptr to an object located on 
the heap, that won't work as expected either when you try to lock it.

Cheers,
Kristofer

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





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


Re: [osg-users] osg::observer_ptr and osg::ref_ptr

2018-10-23 Thread Kristofer Krus
Hi Robert,

Ah, that's clever. So the observer_ptr basically acts like ref_ptr when it 
comes to the ObserverSet object and deletes that object when the last 
observer_ptr object is destructed? :D 

Cheers!

Kristofer

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





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


Re: [osg-users] osg::observer_ptr and osg::ref_ptr

2018-10-18 Thread Kristofer Krus
Seems handy!

So how can nodeObs become NULL when the Node object is deleted? Does the latter 
store a list of the observer_ptr objects that it is observed by, and set them 
all to NULL when it is destructed? Or how does it work?

Cheers,
Kristofer

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





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


Re: [osg-users] Draw two translucent geometries in specific order

2018-05-21 Thread Kristofer Krus
Hi Robert,

Thanks for your reply.

The problem was that setRenderingHint(osg::StateSet::TRANSPARENT_BIN) was 
called after I called setRenderBinDetails. While I checked that 
setRenderBinDetails was not called anywhere else in the code, I didn't know 
that you could also choose render bin through the setRenderingHint method. 
Removing the calls to setRenderingHint resolved the problem.

Cheers,
Kristofer

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





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


Re: [osg-users] List render bins

2018-05-21 Thread Kristofer Krus
Hi,

I'm trying to gain a greater understanding of render bins, and I was thinking 
both, basically. I.e. both what render bins OSG created when the application 
started, and what render bins are created by the application I'm working with. 
This snippet of code was helpful, though, thanks.

I didn't expect there to be a method specifically for listing all render bins, 
but I imagine there must be some container or something they are stored in, and 
I wanted to loop through all elements in this container and print information 
about them.

Cheers,
Kristofer

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





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


Re: [osg-users] Draw two translucent geometries in specific order

2018-05-21 Thread Kristofer Krus
Hi again robertosfield, I took a look at the code you posted at this thread 
(http://forum.openscenegraph.org/viewtopic.php?t=17289), and it gave me some 
further questions.

According to this code, there seems like there are six default rendering bins, 
and I don't see that any numbers are associated with them. However, the article 
(http://www.bricoworks.com/articles/stategraph/stategraph.html) I linked to 
claims there are two default rendering bins, numbered 0 and 10. Why does that 
article claim that, if the code seems to imply something very different? Also, 
why would it say that the numbers used for those bins are 0 and 10? That seems 
kind of arbitrary to me and doesn't make much sense.


robertosfield wrote:
> subgraphA->getOrCrreateStateSet()->setRenderinBinDetails("RenderBin", 5); // 
> or "DepthSortedBin" if you have mulitple transparent objects that need sorting
> subgraphB->getOrCrreateStateSet()->setRenderinBinDetails("RenderBin", 6);


There is no method called setRenderinBinDetails, but there is a method called 
setRenderBinDetails. And the order of the arguments for this method is the 
reversed compared to what you write, i.e. setRenderBinDetails(5, "RenderBin") 
and setRenderBinDetails(6, "RenderBin").

Also, what do the arguments do? When I use the code you suggested, A is now 
always rendered after B, i.e. in the wrong order, no matter if I use the 
numbers 5 and 6 or if I swap them so that I use the numbers 6 and 5. (This 
seems to be independent of the direction I view the scene from, which is a good 
thing, though.) I had the impression that render bins with higher numbers would 
always be rendered later, and that the number we provide as an argument to 
setRenderBinDetails is the number of the bin we want to put the subgraph in, 
but this doesn't seem to be the case.

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





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


Re: [osg-users] Draw two translucent geometries in specific order

2018-05-21 Thread Kristofer Krus

Chris Hanson wrote:
> You might also look at OSGTransparencyToolkit. 
> http://alphapixel.com/project/osg-transparency-toolkit/ 
> (http://alphapixel.com/project/osg-transparency-toolkit/)
> 
> There are several Order Independent Transparency implementation out there 
> that let you not worry about the object draw order.


Thanks, I might possibly take a look at this if I can't make it work in any 
other way. Currently, I just want to make sure B is rendered after A (and that 
A and B are both rendered after everything else, which is fully opaque).

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





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


[osg-users] List renderbins

2018-05-21 Thread Kristofer Krus
Hi,

Is there some way in which I can list all existing render bins and print 
details about them, i.e. number, name and mode (the details given to 
setRenderBinDetails 
(http://public.vrac.iastate.edu/vancegroup/docs/OpenSceneGraphReferenceDocs-3.0/a00762.html#a498095c3811e00b2fc6123a24ef5ec81))?

Thank you!

Cheers,
Kristofer

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





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


Re: [osg-users] Draw two translucent geometries in specific order

2018-05-18 Thread Kristofer Krus
Hi,

Thanks for the reply Robert! I think the concept of render bin sounds logical, 
but I'm slightly confused about how RenderBins work in OSG (OpenSceneGraph). 
I’ve tried to find information about what RenderBins are and how to use them, 
but what I’ve been able to find so far has been limited, so I still have some 
questions about them:

1. Why does a bin have both a number and a name? Wouldn’t just one of those be 
enough as an identifier?

2. The article http://www.bricoworks.com/articles/stategraph/stategraph.html 
seems to imply that there are two default RenderBins: One with number 0 in 
which OSG puts all opaque objects and one with number 10 in which it puts all 
translucent objects. Is that how it works?

3. What are the names of those bins? (Or is that unimportant?)

4. How does OSG determine whether an object is translucent in order to put it 
into the correct bin? Does it look at all the colors and textures that are 
associated with the object and check whether at least some polygon or some 
pixel is translucent?

5. Will OSG’s choice of RenderBin to put each object in, based on translucency, 
be overridden if I use setRenderBinDetails 
(http://public.vrac.iastate.edu/vancegroup/docs/OpenSceneGraphReferenceDocs-3.0/a00762.html#a498095c3811e00b2fc6123a24ef5ec81)?
 I see that this method also takes an optional mode 
(http://public.vrac.iastate.edu/vancegroup/docs/OpenSceneGraphReferenceDocs-3.0/a00762.html#a43d4fd1ed6001ab862e89e7c4e877ff1).
 Does this variable have something to do with that? What does it do?

6. When I call setRenderBinDetails, if I specify a bin number that doesn’t 
exist, will this create a new bin?

7. If a bin with than number already exists, will the function call change the 
name and mode of that bin?

8. In your reply, you used the numbers 5 and 6. Was there some reason you did 
so, or was the choice of numbers arbitrary?

Finally, is there some other source, except from 
http://www.bricoworks.com/articles/stateset/stateset.html and 
http://www.bricoworks.com/articles/stategraph/stategraph.html (and the 
OpenSceneGraph source code) that you can recommend that explains how render bin 
works in OpenSceneGraph in greater detail?

Cheers,
Kristofer

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





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


[osg-users] Draw two translucent geometries in specific order

2018-05-18 Thread Kristofer Krus
Hi,

I have two geometries, A and B, that are both translucent, of which A should 
always be rendered before B because it is farther from the camera 
fragment-wise. However, OpenSceneGraph sometimes renders A first and sometimes 
renders B first, depending on the viewing angle, which, when B is rendered 
first, causes A to disappear at the fragments where A and B overlap.

How can I make sure A is always rendered first and then B?

Thank you!

Cheers,
Kristofer

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





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


Re: [osg-users] [build] "INSTALL.vcxproj" -- FAILED

2018-05-04 Thread Kristofer Krus

ceranco wrote:
> I have no Cmake knowledge, so I didn't change the Cmake script, but rather 
> manually changed the project configurations for all of the examples in visual 
> studio. Right click on the project, select properties. Go to Linker -> 
> Debugging and change the Generate Program Database File to 
> $(ProjectDir)$(AssemblyName)d.pdb


This worked for me too. If, in Visual Studio, you can mark all the projects in 
the Examples folder, right-click and select Properties, you can make a 
bulk-change for the Generate Program Database File property. That way you don't 
have to make this change for every example separately.

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





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