Re: [osg-users] GL_POINTS vs GL_LINES: same vertices displayed at different positions on screen

2011-04-08 Thread Trond Vidar Stensby
Take a look at these:
http://stackoverflow.com/questions/4532342/opengl-gl-lines-enpoints-not-joining
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatNumber=235566
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatNumber=237621

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





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


Re: [osg-users] Object transparency

2010-08-23 Thread Trond Vidar Stensby
The soloution depends on what you want to achieve. 

The artifacts that you are seing is a result of drawing the triangles in an 
arbitrary order. Generally you want to draw transparent triangles from back to 
front. You need to implement a view dependent sort algorithm of the triangles 
in order to achieve this. If the number of triangles is large this may become 
too expensive in an interactive application.

However, if the triangles facing away from the camera (back-side of person) is 
of no interest then a quick fix is to disable drawing these triangles. You can 
easily achieve this using the osg::CullFace state attribute. In your example 
you seem to draw both the front and back side of your triangles. Set it so that 
only front facing triangles are drawn.

Using the latter approach only works for simple geometries where the 
triangles on the back-side also faces in the opposite direction. A torso like 
you show is mostly like that, but you will see arifacts if you for example move 
an arm in front or behind the torso. 

An improvement to the latter approach is to split the body into multiple parts 
(each with an associated bounding box) and then sort the different parts in a 
back to front fashion (osg does this automaticlly for the transparent bin). 
Each part must only draw the front facing triangles.

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





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


Re: [osg-users] dynamic_cast of referenced objects

2010-02-08 Thread Trond Vidar Stensby

HomerSimpson wrote:
 My project is throwing an occasional unhandled win32 exception error and 
 I've been trying to figure out why.


One thing you should check is if you have any raw C++ pointers pointing to 
objects that are also pointed to by ref_ptr's. Accessing the object through the 
raw pointer after that the ref_ptr's have gone out of scope is illegal since 
the object is automaticly destroyed when the last ref_ptr goes out of scope.

Notice that since OSG uses ref_ptr's in most places any object that you add to 
a scenegraph will most likely be referenced by a ref_ptr. You should therefore 
try to avoid using raw pointers to such objects. It's safer to use ref_ptr's.

Example: the following will fail


Code:
osg::Node* myTransform = new osg::MatrixTransform();
{
osg::ref_ptr osg::Group  myGroup = new osg::Group();
myGroup-addChild(myTransform);
}
myTransform-someMethod(); // Wrong. Object has been deleted.




In the example above replace the first line with:

Code:
osg::ref_ptr osg::Node  myTransform = new osg::MatrixTransform();


and use myTransform.get() inside the addChild call.

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





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