Re: [osg-users] [osgPlugins] osgDB::readImageFile() chooses ffmpeg over libpng

2015-05-11 Thread Robert Osfield
Hi Paul,

This sounds like a bug, the ffmpeg plugin should not attempt to load a
png file.  What exactly happens?

As for changing the order, simple pre load the png plugin as this will
ensure it gets called first thanks to the Chain-Of-Responsibility
pattern used by it.

Robert

On 10 May 2015 at 23:49, Paul aquawic...@hotmail.com wrote:
 OSG-3.3.7

 both plugins osgdb_png and osgdb_ffmpeg loaded.
 osgDB::readImageFile(image.png) chooses ffmpeg over libpng to load .png 
 image files.

 I checked ReaderWriterFFmpeg.cpp, and it does not add the .png extention.

 How do I give libpng priority on .png files. Thanks :)

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





 ___
 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] Forcing a scene to rebind textures

2015-05-11 Thread Robert Osfield
Hi Philippe,

On 10 May 2015 at 22:24, Philippe Renon philippe_re...@yahoo.fr wrote:
 As a matter of fact I have a GraphicsContext managed by osg.
 And it properly gets destroyed.

 I later create a new View and set on it the scene data that was previously 
 set on the other view (which is now discarded).
 I then see the errors below and get crashes.
 Please note that this does not happen on simple scenes but on scenes 
 containing osgearth maps.

 There is something I am not doing properly when destorying the 1s view which 
 leaves the scene in a bad state. Question is to find what is wrong with the 
 scene.

Is there any chance your application is caching a subgraph that isn't
attached to the view/contexts that are destroyed so are effectively
hidden by the releaseGLObjects() operation?   If you re-attach such a
subgraph to a new context it's handles to GL objects will all still be
there but won't be valid.

If you do cache subgraphs in this way then you need to call
rootnode-releaseGLObjects(); on it prior to deleting the context, or
call releaseGLObjectse() afterwards then osg::discardAllGLObjects();

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


Re: [osg-users] qt plots over viewer

2015-05-11 Thread Gianni Ambrosio
Hi All,
I tried several solutions but I didn't find a full working solution yet.

Here is a piece of code that shows and is able to update the image of a qt 
widget but I'm not able to make the move and resize working.


Code:

void MyViewer::addOverlay(QWidget* iWidget)
{
   osgWidget::Window* osgwindow = new osgWidget::Canvas;
   osgwindow-attachMoveCallback();
   osgwindow-attachScaleCallback();
   osgwindow-setVisibilityMode(osgWidget::Window::VM_ENTIRE);
   osgwindow-getBackground()-setColor(osg::Vec4(1, 1, 1, 0.5));

   osg::ref_ptrosgQt::QWidgetImage widgetImage = new 
osgQt::QWidgetImage(iWidget);
   widgetImage-getQGraphicsViewAdapter()-setBackgroundColor(QColor(0xff, 
0xff, 0xff, 0x80));

   osg::Geometry* quad = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0), 
osg::Vec3(1,0,0), osg::Vec3(0,1,0), 1, 1);
   osg::Geode* geode = new osg::Geode;
   geode-addDrawable(quad);

   osg::Texture2D* texture = new osg::Texture2D(widgetImage.get());
   texture-setResizeNonPowerOfTwoHint(false);
   texture-setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
   texture-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
   texture-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);

   osg::Camera* camera = new osg::Camera;
   camera-setProjectionResizePolicy(osg::Camera::FIXED);
   camera-setProjectionMatrix(osg::Matrix::ortho2D(0,1,0,1));
   camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
   camera-setViewMatrix(osg::Matrix::identity());
   camera-setClearMask(GL_DEPTH_BUFFER_BIT);
   camera-setRenderOrder(osg::Camera::POST_RENDER);
   camera-addChild(geode);
   camera-setViewport(0, 0, 512, 384);

   osgwindow-getOrCreateStateSet()-setTextureAttributeAndModes(0, texture, 
osg::StateAttribute::ON);
   osgwindow-getOrCreateStateSet()-setMode(GL_LIGHTING, 
osg::StateAttribute::OFF);
   osgwindow-getOrCreateStateSet()-setMode(GL_BLEND, osg::StateAttribute::ON);
   
osgwindow-getOrCreateStateSet()-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
   osgwindow-getOrCreateStateSet()-setAttribute(new osg::Program);
   osgwindow-addChild(camera);

   osgViewer::InteractiveImageHandler* handler = new 
osgViewer::InteractiveImageHandler(widgetImage.get(), texture, camera);
   quad-setEventCallback(handler);
   quad-setCullCallback(handler);

   windowManager-addChild(osgwindow);
}




Can anybody explain me please why

osgwindow-attachMoveCallback();
osgwindow-attachScaleCallback();

do not work?

I can discard that and derive my own InteractiveImageHandler but first of all 
that's not what I did for other 3D widgets where I used a drawable as child 
of an osgwindow's geode and move/scale works correctly.
On the other side I would like to know which is the proper way to show a qt 
widget in a 3D viewer so that its image can be updated but also its rectangle 
moved and scaled.

Regards,
Gianni

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





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


Re: [osg-users] [forum] Huge delays while mouse clicking with many draggers in scene

2015-05-11 Thread Jaap Glas
Dear all,

I agree with Robert that the whole scene has to be tested to avoid
picking obscured draggers. But this will not be a real computational
burden if it would happen only once for every new event. As long
as it is not redone for every dragger again.

I am aware that the original dragger code was made by others.
And our current workaround works fine for us. We do not need
an immediate fix.

The main reason to post it on the forum is to signal that the problem
exists and to share our findings with others that may search for an
explanation or a solution.


Best regards,

Jaap Glas

-- dr Jaap C. Glas
-- Software Engineer
-- dGB Earth Sciences
-- Phone: +31 53 4315155
-- Email: 
-- Internet: dgbes.com  opendtect.org



robertosfield wrote:
 Hi Jaap,
 
 The whole scene is tested so that obscured dragger don't get picked
 unintentionally.  Each dragger doing the same intersection traversal
 is inefficient though, athough as I'm not the original author of
 osgManipulator I'd had to do a code review to look at all the
 possibilities and consequences.  I'm current deep in another complex
 part of the OSG so don't have the spare brain capacity or time to do a
 review right away.
 
 Cheers,
 Robert.
 
 On 6 May 2015 at 17:49, Jaap Glas  wrote:
 
  Dear all,
  
  I am an employee of dGB Earth Sciences, and we use OpenSceneGraph for
  the 3D visualization of our open-source seismic interpretation package
  OpendTect.
  
  Our scenes may sometimes contain hundreds to thousands of draggers, mostly
  Translate(1D/2D)Draggers. We found that mouse clicking in the scene becomes
  very slow in that case. It turns out that every OSG dragger tries to 
  intersect
  the line from camera eye to mouse position with all objects in the scene in
  order to produce its private list of intersections:
  
  [osgManipulator/Dragger.cpp:371]
  if ( view-computeIntersections(ea ,intersections,_intersectionMask) )
  
  My question is whether this is really necessary? I don't see (yet) why
  this list cannot be calculated only once and shared by all OSG draggers.
  Or alternatively, only calculated for draggers that are located under the
  mouse pointer.
  
  Our current workaround consists of derived dragger classes that overload
  the Dragger::traverse(.) function to test this latter alternative in 
  advance,
  passing the current node path as an extra parameter:
  
  if ( !view-computeIntersections(*ea,nv.getNodePath(),intersections,
  _intersectionMask) ) continue;
  
  This reduces the computational order of mouse clicking from quadratic to
  linear with the number of draggers in the scene. And mouse clicking in the
  scene can be done again without huge delay.
  
  However, the question is whether such a shortcut would apply in the general
  case. Why is the osgManipulator::Dragger class doing this the way it does?
  
  
  Best regards,
  
  Jaap Glas
  
  
  -- dr Jaap C. Glas
  -- Software Engineer
  -- dGB Earth Sciences
  -- Phone: +31 53 435155
  -- Email:
  -- Internet: dgbes.com  opendtect.org
  
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=63651#63651
  
  
  
  
  
  ___
  osg-users mailing list
  
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


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





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


[osg-users] [GL ES2] Add slave camera

2015-05-11 Thread Jean Baptiste Poquelin
Hi everyone,

Is it possible to add a slave camera in an embedded viewer? I am trying to 
perform render-to-texture in multiple cameras simultaneously and everything 
works fine until I try to add a slave camera on the viewer.

Here is the context (simplified):

Code:

// Create an X11/EGL display/context
...

// Create a viewer
viewer = new osgViewer::Viewer();
osg::ref_ptrosgViewer::GraphicsWindow graphics_window = 
viewer-setUpViewerAsEmbeddedInWindow(0, 0, 640, 480);

// Create a texture
texture = new osg::Texture2D;
texture-setTextureSize(640, 480);
texture-setInternalFormat(GL_RGBA);
texture-setSourceFormat(GL_RGBA);
texture-setSourceType(GL_FLOAT);
texture-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
texture-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
texture-setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
texture-setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);

// Create a camera
camera = new osg::Camera;
camera-setViewport(0, 0, texture-getTextureWidth(), 
texture-getTextureHeight());
camera-setClearColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.0f));
camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
camera-setRenderOrder(osg::Camera::PRE_RENDER);
camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera-setReferenceFrame(osg::Camera::ABSOLUTE_RF);

// Attach texture to camera
camera-attach(osg::Camera::COLOR_BUFFER, texture);

// Bind the texture object
osg::State state = *graphics_window-getState();
texture-apply(state);

// Load the camera
viewer-addSlave(camera-get());




The last call fails with the message: free(): invalid pointer
Am I missing something?

Thank you!

Cheers,
Jean

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





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


Re: [osg-users] Light/Material flickering

2015-05-11 Thread Şan Güneş
Hi,

On Mon, May 11, 2015 at 4:03 PM, João joao.henrique.pi...@hotmail.com
wrote:

 I'm currently loading .osg models to a scene, and I'm experiencing some
 inconsistencies when it comes to texturing and lighting in those models.


I'm not sure, but did you try enabling the GL_RESCALE_NORMAL attribute for
the state sets of the objects? It's also mentioned in the FAQ.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light/Material flickering

2015-05-11 Thread João
Neither GL_RESCALE_NORMAL or GL_NORMALIZE resolved the situation.

Date: Mon, 11 May 2015 16:09:56 +0300
From: sgu...@350.su
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Light/Material flickering

Hi,

On Mon, May 11, 2015 at 4:03 PM, João joao.henrique.pi...@hotmail.com wrote:



I'm currently loading .osg models to a scene, and I'm experiencing some 
inconsistencies when it comes to texturing and lighting in those models.
I'm not sure, but did you try enabling the GL_RESCALE_NORMAL attribute for the 
state sets of the objects? It's also mentioned in the FAQ.

___
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] serializer,custom node with custom nodecallback

2015-05-11 Thread Xia Baobao
Hi,

I want to implement a custom node with a custom nodecallback by serializer.
I have read a chapter of serializer in OpenSceneGraph 3.0 Beginner's Guide and 
this webpage - 
http://trac.openscenegraph.org/projects/osg//wiki/Support/KnowledgeBase/SerializationSupport

I know how to  implement a custom node now.
But I am somewhat confused about how to implement  custom node with a custom 
nodecallback.
I can do it with Custom Serializers now.

Code:
namespace test {
class CustomNode : public osg::Group
{
public:
CustomNode() : osg::Group(), _exampleID(0) {}
CustomNode(const CustomNode copy,const osg::CopyOp 
copyop=osg::CopyOp::SHALLOW_COPY)
: osg::Group(copy, copyop), _exampleID(copy._exampleID) 
{}
META_Node(test, CustomNode)
void setExampleID( unsigned int id ) { _exampleID = id; 
}
unsigned int getExampleID() const { return _exampleID; }
protected:
unsigned int _exampleID;
};
}

class CustomNodeCallBack : public osg::NodeCallback
{
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
{
printf (custom node call back.\n);
}
};
static bool checkCustomCallBack( const test::CustomNode node )
{
return true;
}
static bool writeCustomCallBack( osgDB::OutputStream os, const 
test::CustomNode node )
{
return true;
}
static bool readCustomCallBack( osgDB::InputStream is, test::CustomNode node )
{
node.addUpdateCallback( new CustomNodeCallBack );
return true;
}

REGISTER_OBJECT_WRAPPER( CustomNode_Wrapper,
new test::CustomNode,
test::CustomNode,
osg::Object osg::Node 
osg::Group test::CustomNode )
{
ADD_UINT_SERIALIZER( ExampleID, 0 );
ADD_USER_SERIALIZER( CustomCallBack );
}




I think maybe I can also do this without  Custom Serializers.
Which means I think I can implement a node serializer and a nodecallback 
serializer, then add the callback to the node.
the code may look like this

Code:
namespace test {
class CustomNodeCallBack : public osg::NodeCallback
{
public:
..
META_NodeCallBack(test, CustomNode)
..
};
}

REGISTER_OBJECT_WRAPPER( CustomNodeCallBack_Wrapper,
new test::CustomNodeCallBack,
test::CustomNodeCallBack,
osg::Object osg::NodeCallBack 
test::CustomNodeCallBack )
{
..
}

namespace test {
class CustomNode : public osg::Group
{
public:
..
META_Node(test, CustomNode)
..
};
}
REGISTER_OBJECT_WRAPPER( CustomNode_Wrapper,
new test::CustomNode,
test::CustomNode,
osg::Object osg::Node 
osg::Group test::CustomNode )
{
ADD_OBJECT_SERIALIZER( UpdateCallback, test::CustomNodeCallBack , NULL)
}


But I do not know how to implement a nodecallback serializer. There is 
META_Node for node serializer, but there is nothing named META_NodeCallBack.

I want to know how to implement a nodecallback serializer.
Or If there are other ways to make a custom node with a custom nodecallback.

Thank you!

Cheers,
Xia[/code]

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





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


[osg-users] Texture Mapping Meeting Point Shadow

2015-05-11 Thread Erik Hensens
Hello all!

I'm having trouble with image texture mapping a geode. Specifically, where the 
top and the bottom of the image meet, there is a dark shadow effect that I want 
to avoid.

I've created the simplest example of how I'm attempting the texture mapping and 
I've taken screenshots that show the unwanted shadow (please see the attached 
screenshots and the overlay image itself).

Below is the code I'm using. As you can see, it's very simple: just four 
quadrangle faces that form four sides of an open-ended box. I've attempted to 
map the overlay image around the entire box so that the top and bottom meet at 
one of the four edges.

Does anyone have any idea what I'm doing wrong or how I can modify my code to 
get rid of the shadow effect? Thanks a bunch in advance!


Code:
// Create the new geode node
osg::ref_ptr  osg::Geode  pGeode = new osg::Geode;

// Create the single new geometry
osg::ref_ptr  osg::Geometry  pGeometry = new osg::Geometry;

// The vertex array to define the geometry shape
osg::ref_ptr  osg::Vec3Array  pVertices = new osg::Vec3Array;

// Add face 1/4 quad vertices
pVertices-push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
pVertices-push_back(osg::Vec3(10.0f, 0.0f, 0.0f));
pVertices-push_back(osg::Vec3(10.0f, 5.0f, 5.0f));
pVertices-push_back(osg::Vec3(0.0f, 5.0f, 5.0f));

// Add face 2/4 quad vertices
pVertices-push_back(osg::Vec3(0.0f, 5.0f, 5.0f));
pVertices-push_back(osg::Vec3(10.0f, 5.0f, 5.0f));
pVertices-push_back(osg::Vec3(10.0f, 0.0f, 10.0f));
pVertices-push_back(osg::Vec3(0.0f, 0.0f, 10.0f));

// Add face 3/4 quad vertices
pVertices-push_back(osg::Vec3(0.0f, 0.0f, 10.0f));
pVertices-push_back(osg::Vec3(10.0f, 0.0f, 10.0f));
pVertices-push_back(osg::Vec3(10.0f, -5.0f, 5.0f));
pVertices-push_back(osg::Vec3(0.0f, -5.0f, 5.0f));

// Add face 4/4 quad vertices
pVertices-push_back(osg::Vec3(0.0f, -5.0f, 5.0f));
pVertices-push_back(osg::Vec3(10.0f, -5.0f, 5.0f));
pVertices-push_back(osg::Vec3(10.0f, 0.0f, 0.0f));
pVertices-push_back(osg::Vec3(0.0f, 0.0f, 0.0f));

// Set the vertex array on the geometry
pGeometry-setVertexArray(pVertices);

// Create the geometry's color array
osg::ref_ptr  osg::Vec4Array  pColors = new osg::Vec4Array;
pColors-push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));

// Set the color array on the geometry
pGeometry-setColorArray(pColors);
pGeometry-setColorBinding(osg::Geometry::BIND_OVERALL);

// Set the quad draw array on the geometry
osg::ref_ptr  osg::DrawArrays  pDrawArrays = new 
osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, static_cast  GLsizei 
(pVertices-size()));
pGeometry-addPrimitiveSet(pDrawArrays);

// Load the overlay image
osg::ref_ptr  osg::Image  pImage = osgDB::readImageFile(overlay.png);

// Create the image texture
osg::ref_ptr  osg::Texture2D  pTexture = new osg::Texture2D(pImage);

// Create the texture coordinates array
osg::ref_ptr  osg::Vec2Array  pTexCoords = new osg::Vec2Array;

// Set face 1/4 quad texture overlay coordinates
pTexCoords-push_back(osg::Vec2(0.0f, 0.0f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.0f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.25f));
pTexCoords-push_back(osg::Vec2(0.0f, 0.25f));

// Set face 2/4 quad texture overlay coordinates
pTexCoords-push_back(osg::Vec2(0.0f, 0.25f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.25f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.50f));
pTexCoords-push_back(osg::Vec2(0.0f, 0.50f));

// Set 3/4 quad texture overlay coordinates
pTexCoords-push_back(osg::Vec2(0.0f, 0.50f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.50f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.75f));
pTexCoords-push_back(osg::Vec2(0.0f, 0.75f));

// Set 4/4 quad texture overlay coordinates
pTexCoords-push_back(osg::Vec2(0.0f, 0.75f));
pTexCoords-push_back(osg::Vec2(1.0f, 0.75f));
pTexCoords-push_back(osg::Vec2(1.0f, 1.0f));
pTexCoords-push_back(osg::Vec2(0.0f, 1.0f));

// Set the geometry's texture coordinates array
pGeometry-setTexCoordArray(0, pTexCoords);

// Get the geometry's stateset
osg::ref_ptr  osg::StateSet  pStateSet = pGeometry-getOrCreateStateSet();

// Set the texture on the stateset
pStateSet-setTextureAttributeAndModes(0, pTexture, osg::StateAttribute::ON);

// Set the geometry's stateset
pGeometry-setStateSet(pStateSet);

// Add the single drawable to the geode node
pGeode-addDrawable(pGeometry);

// Add this new geode to the scene
pTopGroupNode-addChild(pGeode);



Cheers,
Erik

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



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


Re: [osg-users] Forcing a scene to rebind textures

2015-05-11 Thread Philippe Renon

robertosfield wrote:
 Hi Philippe,
 Is there any chance your application is caching a subgraph that isn't
 attached to the view/contexts that are destroyed so are effectively
 hidden by the releaseGLObjects() operation?   If you re-attach such a
 subgraph to a new context it's handles to GL objects will all still be
 there but won't be valid.
 
 If you do cache subgraphs in this way then you need to call
 rootnode-releaseGLObjects(); on it prior to deleting the context, or
 call releaseGLObjectse() afterwards then osg::discardAllGLObjects();
 


Thank Robert, 
I think you are pointing me in the right direction.

By caching do you mean such a scenario:
1- realize and render a scene
2- detach a subgraph
3- remove View / close the GraphicsContext
4- create a new View with some scene and reattach the subgraph from step 2

Note that in my scenario (i.e. creating/detroying the same view+scene 
multiple times) the CompositeViewer itself remains the same. Views get added 
and removed but there is only one View at any time in that viewer (so I 
probably should not use CompositeViewer but I don't think it is relevant and I 
might need it in the future).

PS : Just tried to do the suggested cleanups after creating the view.
Code looks like this


Code:

viewer-addView(view);

// needed when adding a view a 2nd time (osg will not realize the viewer 
again...)
if (!viewer-isRealized()) {
viewer-realize();
}

view-releaseGLObjects();

unsigned int contextID = 
view-getCamera()-getGraphicsContext()-getState()-getContextID();
osg::discardAllGLObjects(contextID);




But I still get the invalid enumerant error followed by a crash.

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





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


Re: [osg-users] Google and Authoritative Distributor of Open Source Software (OSG)?

2015-05-11 Thread Frank Kane
Wow, sounds like they are lumping you in with all the bad apples who try and 
trick people into paying for free software.

They've never gotten on my case for my own OSG-related ads, but that might be 
because I don't offer OSG for download, just SDK's that depend on OSG. The same 
would hopefully also be true for osgVisual, should they want to run AdWords 
campaigns.

Completing that form would require certifying that Osfield blessed Alpha Pixel 
as the sole authorized distributor of OSG.

My opinion is that the only way out of this would be to host your OSG binary 
downloads from openscenegraph.org somehow accompanied by a link back to Alpha 
Pixel, or perhaps from some other domain that you're not linking ads to. But 
now that they've flagged you, that might not be enough. 

That really sucks. FWIW I find the quality of AdWords traffic to be pretty 
suspect anyhow. Maybe you could could use this as an opportunity to see if 
losing AdWords traffic actually impacts your business.

--
Frank Kane
Founder, Sundog Software
http://www.sundog-soft.com
The SilverLining Sky, 3D Cloud, and Weather SDK 
The Triton Ocean SDK

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





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


Re: [osg-users] Forcing a scene to rebind textures

2015-05-11 Thread Jannik Heller
Hi filnet,


 
 Code looks like this 
 
 But I still get the invalid enumerant error followed by a crash.
 


there is one missing step in your code - you said you have a detached subgraph. 
The OSG does not hold any pointers to detached subgraphs, so it can't do the 
cleanup on its own. Only your application knows where those subgraphs are 
stored.

So instead of


Code:

view-releaseGLObjects(); 



You need to

Code:

for all detached subgraphs:
node-releaseGLObjects();




View::releaseGLObjects can only release objects that are currently attached to 
the root scene graph.

Cheers,
Jannik[/quote][/code]

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





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


Re: [osg-users] Texture Mapping Meeting Point Shadow

2015-05-11 Thread Farshid Lashkari
Hi Erik,

That looks like a texture wrap issue. Try setting your texture wrap mode to
CLAMP_TO_EDGE:

pTexture-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
pTexture-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);

Cheers,
Farshid

On Mon, May 11, 2015 at 12:39 PM, Erik Hensens ehens...@hunter.com wrote:

 Hello all!

 I'm having trouble with image texture mapping a geode. Specifically, where
 the top and the bottom of the image meet, there is a dark shadow effect
 that I want to avoid.

 I've created the simplest example of how I'm attempting the texture
 mapping and I've taken screenshots that show the unwanted shadow (please
 see the attached screenshots and the overlay image itself).

 Below is the code I'm using. As you can see, it's very simple: just four
 quadrangle faces that form four sides of an open-ended box. I've attempted
 to map the overlay image around the entire box so that the top and bottom
 meet at one of the four edges.

 Does anyone have any idea what I'm doing wrong or how I can modify my code
 to get rid of the shadow effect? Thanks a bunch in advance!


 Code:
 // Create the new geode node
 osg::ref_ptr  osg::Geode  pGeode = new osg::Geode;

 // Create the single new geometry
 osg::ref_ptr  osg::Geometry  pGeometry = new osg::Geometry;

 // The vertex array to define the geometry shape
 osg::ref_ptr  osg::Vec3Array  pVertices = new osg::Vec3Array;

 // Add face 1/4 quad vertices
 pVertices-push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
 pVertices-push_back(osg::Vec3(10.0f, 0.0f, 0.0f));
 pVertices-push_back(osg::Vec3(10.0f, 5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(0.0f, 5.0f, 5.0f));

 // Add face 2/4 quad vertices
 pVertices-push_back(osg::Vec3(0.0f, 5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(10.0f, 5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(10.0f, 0.0f, 10.0f));
 pVertices-push_back(osg::Vec3(0.0f, 0.0f, 10.0f));

 // Add face 3/4 quad vertices
 pVertices-push_back(osg::Vec3(0.0f, 0.0f, 10.0f));
 pVertices-push_back(osg::Vec3(10.0f, 0.0f, 10.0f));
 pVertices-push_back(osg::Vec3(10.0f, -5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(0.0f, -5.0f, 5.0f));

 // Add face 4/4 quad vertices
 pVertices-push_back(osg::Vec3(0.0f, -5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(10.0f, -5.0f, 5.0f));
 pVertices-push_back(osg::Vec3(10.0f, 0.0f, 0.0f));
 pVertices-push_back(osg::Vec3(0.0f, 0.0f, 0.0f));

 // Set the vertex array on the geometry
 pGeometry-setVertexArray(pVertices);

 // Create the geometry's color array
 osg::ref_ptr  osg::Vec4Array  pColors = new osg::Vec4Array;
 pColors-push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));

 // Set the color array on the geometry
 pGeometry-setColorArray(pColors);
 pGeometry-setColorBinding(osg::Geometry::BIND_OVERALL);

 // Set the quad draw array on the geometry
 osg::ref_ptr  osg::DrawArrays  pDrawArrays = new
 osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, static_cast  GLsizei
 (pVertices-size()));
 pGeometry-addPrimitiveSet(pDrawArrays);

 // Load the overlay image
 osg::ref_ptr  osg::Image  pImage = osgDB::readImageFile(overlay.png);

 // Create the image texture
 osg::ref_ptr  osg::Texture2D  pTexture = new osg::Texture2D(pImage);

 // Create the texture coordinates array
 osg::ref_ptr  osg::Vec2Array  pTexCoords = new osg::Vec2Array;

 // Set face 1/4 quad texture overlay coordinates
 pTexCoords-push_back(osg::Vec2(0.0f, 0.0f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.0f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.25f));
 pTexCoords-push_back(osg::Vec2(0.0f, 0.25f));

 // Set face 2/4 quad texture overlay coordinates
 pTexCoords-push_back(osg::Vec2(0.0f, 0.25f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.25f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.50f));
 pTexCoords-push_back(osg::Vec2(0.0f, 0.50f));

 // Set 3/4 quad texture overlay coordinates
 pTexCoords-push_back(osg::Vec2(0.0f, 0.50f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.50f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.75f));
 pTexCoords-push_back(osg::Vec2(0.0f, 0.75f));

 // Set 4/4 quad texture overlay coordinates
 pTexCoords-push_back(osg::Vec2(0.0f, 0.75f));
 pTexCoords-push_back(osg::Vec2(1.0f, 0.75f));
 pTexCoords-push_back(osg::Vec2(1.0f, 1.0f));
 pTexCoords-push_back(osg::Vec2(0.0f, 1.0f));

 // Set the geometry's texture coordinates array
 pGeometry-setTexCoordArray(0, pTexCoords);

 // Get the geometry's stateset
 osg::ref_ptr  osg::StateSet  pStateSet =
 pGeometry-getOrCreateStateSet();

 // Set the texture on the stateset
 pStateSet-setTextureAttributeAndModes(0, pTexture,
 osg::StateAttribute::ON);

 // Set the geometry's stateset
 pGeometry-setStateSet(pStateSet);

 // Add the single drawable to the geode node
 pGeode-addDrawable(pGeometry);

 // Add this new geode to the scene
 pTopGroupNode-addChild(pGeode);



 Cheers,
 Erik

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




 ___
 osg-users mailing list
 

Re: [osg-users] Texture Mapping Meeting Point Shadow

2015-05-11 Thread Erik Hensens
That fixed it, thank you so much!

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





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


[osg-users] Google and Authoritative Distributor of Open Source Software (OSG)?

2015-05-11 Thread Chris Hanson
  Has anyone else here who offers download of compiled Open Source software
been hassled by Google? My Google Ads for AlphaPixel's OSG consulting
services (a major part of my business) have been suspended for the
following:

after a discussion with our policy team, it looks like your site was
correctly disabled for our Free Desktop Software policy, which you can find
here
http://t.signauxsix.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1pNd6vW8pTkCF2B8p26Vd76_W56dMzddZXz2n02?si=6460970642178048pi=4A19AD92-5A3E-4F9C-8500-58F2D19BDC2Ft=https%3A%2F%2Fsupport%2Egoogle%2Ecom%2Fadwordspolicy%2Fanswer%2F6023676%23uc.
What they are specifically talking about is this page on your site
alphapixel.com
http://t.signauxsix.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1pNd6vW8pTkCF2B8p26Vd76_W56dMzddZXz2n02?si=6460970642178048pi=4A19AD92-5A3E-4F9C-8500-58F2D19BDC2Ft=http%3A%2F%2Falphapixel%2Ecom.
What they are telling me is that for the software found on that page you
must register as the authoritative distributor of that software through
this form here
http://t.signauxsix.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1pNd6vW8pTkCF2B8p26Vd76_W56dMzddZXz2n02?si=6460970642178048pi=4A19AD92-5A3E-4F9C-8500-58F2D19BDC2Ft=https%3A%2F%2Fsupport%2Egoogle%2Ecom%2Fadwordspolicy%2Fcontact%2Fadvertise%5Fsoftware%5Fpol.
After submitting the form, the policy team will review your site within 1-2
weeks and if they confirm that you are the main distributors of this
software and they will approve the site without any further escalation from
me. I know this isnt the most ideal answer you were looking for, but I have
pushed back immensely and have done all I can but they are standing firmly.
At this time, I think the only option would be to go through the from
process. Please let me know if you have any questions on this matter.


  So, it doesn't seem to me to be sensible to require we register as THE
authoritative software distribution site. This would presumably exclude
others such as Torben (
http://www.osgvisual.org/projects/osgvisual/wiki/Downloads ) which is not
ok.

  It seems to me like Google somehow, doesn't even GET the idea of Open
Source, at least as it applies to binary downloads. Has anyone encountered
this issue?


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Code Forensics • Digital Imaging • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Google and Authoritative Distributor of Open Source Software (OSG)?

2015-05-11 Thread Chris Hanson

 They've never gotten on my case for my own OSG-related ads, but that might
 be because I don't offer OSG for download, just SDK's that depend on OSG.


Well, and those, you CAN claim to be the authoritative sole distributor
for, because those SDKs are yours. I bet you'll get contacted soon about
this same thing, though the issue will be easier for you to solve for the
very reasons you cited.

Completing that form would require certifying that Osfield blessed Alpha
 Pixel as the sole authorized distributor of OSG.


  Yeah. And I think that's absolutely silly to ask of him.


 My opinion is that the only way out of this would be to host your OSG
 binary downloads from openscenegraph.org somehow accompanied by a link
 back to Alpha Pixel, or perhaps from some other domain that you're not
 linking ads to. But now that they've flagged you, that might not be enough.


  Yeah. You're thinking exactly like I am. Part of the reason I offer the
downloads is that I have a fast pipe on a CONUS backbone and I can afford
the bandwidth for people who want to download the big files. Putting it
onto OpenSceneGraph.org sort of negates most of the benefits.


 That really sucks. FWIW I find the quality of AdWords traffic to be pretty
 suspect anyhow. Maybe you could could use this as an opportunity to see if
 losing AdWords traffic actually impacts your business.


  Maybe so. I suspect I get a lot more legitimate traffic from my OSG
downloads page and people who refer me (ahem, like that guy from SunDog
Software -- I owe you some alcoholic beverages sometime...) than from my
Ads anyway. I was just gearing up to have an SEO firm analyze my Ads and
see if they were at all worth what I was paying for them.

  BTW, your SunDog ads are some of the prettiest I see when browsing the
Internet. And I don't even need to click them to find you... ;)

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Code Forensics • Digital Imaging • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Forcing a scene to rebind textures

2015-05-11 Thread Philippe Renon

scrawl wrote:
 Hi filnet,
 
 there is one missing step in your code - you said you have a detached 
 subgraph. The OSG does not hold any pointers to detached subgraphs, so it 
 can't do the cleanup on its own. Only your application knows where those 
 subgraphs are stored.
 
 Jannik


Hi Jannik,

The subgraph is supposed to be reattached before the big cleanup.
I am looking in the code for such cached subgraph but can't find any. 
The only cached object I found is a NodeCallback that gets attached to the 
camera.

I tried to simplify my scene to the extreme.
I removed the SkyNode that was used and now I have only an osgearth map in the 
scene. 
With that change the immediate crash is gone but the enumerant error is still 
there.
On the second use of the scene, the textures visited by zommiing around show 
up black. Zooming further will eventually cause new previously not shown 
textures to appear correctly.

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





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