Re: [osg-users] TexGen limitations

2013-12-13 Thread Robert Osfield
HI Daniel,

It sounds like an OpenGL driver issue. I don't recall any hard limits w.r.t
texture units with texgen but being fixed function state the driver might
not map it all the way up.

Robert.


On 13 December 2013 07:36, Daniel Schmid wrote:

>  Hi there
>
> I noticed a limitation in TexGen. It looks like osg::TexGen can only be
> used up to a texture unit between 0 and 3, starting from texture unit 4 to
> 7, osg::TexGen have no more effect.
>
> You can easily test this with the *osgspotlight.cpp* example by changing
> the following lines:
>
>
>
> Line 249:
>
> xform->addChild(createSpotLightNode(osg::Vec3(0.0f,0.0f,0.0f),
> osg::Vec3(0.0f,1.0f,-1.0f), 60.0f, 0, 1));
>
>
>
> replace the last number (1).
>
>
>
>
>
> Line 275:
>
> root->setStateSet(createSpotLightDecoratorState(0,1));
>
>
>
> replace the last number (1).
>
>
>
> If you use numbers between 0..3, everything works fine, 4 and up doesn’t
> work anymore.
>
>
>
> Where does this limitation come from? Is this OSG or opengl?
>
>
>
> Regards
>
> Daniel
>
>
>
> ___
> 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] TexGen limitations

2013-12-13 Thread Daniel Schmid
I have an Nvidia GTX TITAN with current drivers. Sure this could be a driver 
issue... but I doubt it with such current hardware.
I would be curious if you Robert or anybody could quickly make the test 
according to my previous post and just tell your results.
I know it sounds silly for such a basic issue, but this is what community is 
for... :)

Daniel

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


Re: [osg-users] TexGen limitations

2013-12-13 Thread Daniel Schmid
I made the test now with a GTX 580 and a different driver version, and I still 
have the same issues!

Daniel

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


Re: [osg-users] Curious compiler behavior

2013-12-13 Thread Lionel Lagarde
My problem looks like the osgDB::fstream / std::fstream conflict which 
was resolved using the /FORCE:MULTIPLE linker flag.

Does anyone has more information on this ?

On 12/12/2013 18:39, Lionel Lagarde wrote:
It seems that osg80-osgd.dll contains the symbols of "scalar integer" 
(char, uchar, short, ushort, int, uint) specializations of the

MixinVector.

The vector and floating point specializations are not defined.

On 12/12/2013 18:19, Lionel Lagarde wrote:

Hi,

I use Visual Express C++ 2010.

The following code works very well:
osg::FloatArray *array = ...
(*array)[i] = 10.0;

I decided to add integer support:
osg::IntArray *array = ...
(*array)[i] = 10;

And the linker says:
osgd.lib(osg80-osgd.dll) : error LNK2005: "public: int & __cdecl 
osg::MixinVector::operator[](unsigned __int64)" already defined in 
libseFastOsgCored.lib(OsgUniform.obj)


Any idea ?

___
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] Curious compiler behavior

2013-12-13 Thread Trajce Nikolov NICK
Hi Lionel,

this topic was discussed before as I can recall and there was a neat
solution (with #ifdefs) posted to avoid the conflict. Have a look in the
archive, can not remember the author

Nick


On Fri, Dec 13, 2013 at 1:41 PM, Lionel Lagarde
wrote:

> My problem looks like the osgDB::fstream / std::fstream conflict which was
> resolved using the /FORCE:MULTIPLE linker flag.
> Does anyone has more information on this ?
>
>
> On 12/12/2013 18:39, Lionel Lagarde wrote:
>
>> It seems that osg80-osgd.dll contains the symbols of "scalar integer"
>> (char, uchar, short, ushort, int, uint) specializations of the
>> MixinVector.
>>
>> The vector and floating point specializations are not defined.
>>
>> On 12/12/2013 18:19, Lionel Lagarde wrote:
>>
>>> Hi,
>>>
>>> I use Visual Express C++ 2010.
>>>
>>> The following code works very well:
>>> osg::FloatArray *array = ...
>>> (*array)[i] = 10.0;
>>>
>>> I decided to add integer support:
>>> osg::IntArray *array = ...
>>> (*array)[i] = 10;
>>>
>>> And the linker says:
>>> osgd.lib(osg80-osgd.dll) : error LNK2005: "public: int & __cdecl
>>> osg::MixinVector::operator[](unsigned __int64)" already defined in
>>> libseFastOsgCored.lib(OsgUniform.obj)
>>>
>>> Any idea ?
>>>
>>> ___
>>> 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
>



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


[osg-users] Forum Down

2013-12-13 Thread David Tran
Hi all

I get the following error message, when going to
OpenSceneGraph's official forum, http://forum.openscenegraph.org/:

phpBB : Critical Error

Could not connect to the database

We should make the OpenSceneGraph community more lively :) like
the one in China :-) http://www.osgchina.org/forum.php

100 people online, too bad I can't read chinese

P.S: On a random note, anyone know of any 3D geometric libraries that
I can plug into OpenSceneGraph that contain data structures for
topology and mesh connectivity? -accessing neighbouring vertices, etc.
(Anything would be great! - something similar to BuildLinks in VTK)

I know of OpenMesh (but someone said it wasn't compatible), CGAL (heard it
has too
much meta programming making it difficult to use), GTS (hasn't been updated
in awhile), VCG (I know MeshLab uses this; not sure if it fits into
OpenSceneGraph), Carve CSG (was playing with its half edge data structure
and boolean CSG - a nice library used in Blender), osgModeling (the author
Wang Rui says don't use this and that he's working on a new version in a
project called osgXI - btw I'm reading your book!); I only recently picked
up OpenSceneGraph a few days ago and have been playing around with it so
I'm still learning how to deal with dynamic geometry as well, so any help,
tips, suggestions, direction would be great :) Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Curious compiler behavior

2013-12-13 Thread Lionel Lagarde

Hi Nick,

The solution involving the #ifdefs is to use the osgDB::fstream classes 
instead of the std ones using #defines:


#ifdef WIN32

// Replace STL fstream with OSG fstream
#include 
#define ifstream osgDB::ifstream
#define ofstream osgDB::ofstream

#else

#include 
#define ifstream std::ifstream
#define ofstream std::ofstream

#endif

It doesn't apply in my case.

But I manage to make the it works using directly the vector 
implementation of the MixinVector:

osg::IntArray *array = ...
std::vector &v = array->asVector();
v[0] = 10;




On 13/12/2013 11:50, Trajce Nikolov NICK wrote:

Hi Lionel,

this topic was discussed before as I can recall and there was a neat 
solution (with #ifdefs) posted to avoid the conflict. Have a look in 
the archive, can not remember the author


Nick


On Fri, Dec 13, 2013 at 1:41 PM, Lionel Lagarde 
mailto:lionel.laga...@oktal-se.fr>> wrote:


My problem looks like the osgDB::fstream / std::fstream conflict
which was resolved using the /FORCE:MULTIPLE linker flag.
Does anyone has more information on this ?


On 12/12/2013 18:39, Lionel Lagarde wrote:

It seems that osg80-osgd.dll contains the symbols of "scalar
integer" (char, uchar, short, ushort, int, uint)
specializations of the
MixinVector.

The vector and floating point specializations are not defined.

On 12/12/2013 18:19, Lionel Lagarde wrote:

Hi,

I use Visual Express C++ 2010.

The following code works very well:
osg::FloatArray *array = ...
(*array)[i] = 10.0;

I decided to add integer support:
osg::IntArray *array = ...
(*array)[i] = 10;

And the linker says:
osgd.lib(osg80-osgd.dll) : error LNK2005: "public: int &
__cdecl osg::MixinVector::operator[](unsigned __int64)"
already defined in libseFastOsgCored.lib(OsgUniform.obj)

Any idea ?

___
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




--
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


Re: [osg-users] Curious compiler behavior

2013-12-13 Thread Trajce Nikolov NICK
yes, that was what I saw earlier in one post. But good you made it work :-)

Nick


On Fri, Dec 13, 2013 at 3:00 PM, Lionel Lagarde
wrote:

>  Hi Nick,
>
> The solution involving the #ifdefs is to use the osgDB::fstream classes
> instead of the std ones using #defines:
>
> #ifdef WIN32
>
> // Replace STL fstream with OSG fstream
> #include 
> #define ifstream osgDB::ifstream
> #define ofstream osgDB::ofstream
>
> #else
>
> #include 
> #define ifstream std::ifstream
> #define ofstream std::ofstream
>
> #endif
>
>
> It doesn't apply in my case.
>
> But I manage to make the it works using directly the vector implementation
> of the MixinVector:
>
> osg::IntArray *array = ...
> std::vector &v = array->asVector();
> v[0] = 10;
>
>
>
>
>
> On 13/12/2013 11:50, Trajce Nikolov NICK wrote:
>
> Hi Lionel,
>
>  this topic was discussed before as I can recall and there was a neat
> solution (with #ifdefs) posted to avoid the conflict. Have a look in the
> archive, can not remember the author
>
>  Nick
>
>
> On Fri, Dec 13, 2013 at 1:41 PM, Lionel Lagarde <
> lionel.laga...@oktal-se.fr> wrote:
>
>> My problem looks like the osgDB::fstream / std::fstream conflict which
>> was resolved using the /FORCE:MULTIPLE linker flag.
>> Does anyone has more information on this ?
>>
>>
>> On 12/12/2013 18:39, Lionel Lagarde wrote:
>>
>>> It seems that osg80-osgd.dll contains the symbols of "scalar integer"
>>> (char, uchar, short, ushort, int, uint) specializations of the
>>> MixinVector.
>>>
>>> The vector and floating point specializations are not defined.
>>>
>>> On 12/12/2013 18:19, Lionel Lagarde wrote:
>>>
 Hi,

 I use Visual Express C++ 2010.

 The following code works very well:
 osg::FloatArray *array = ...
 (*array)[i] = 10.0;

 I decided to add integer support:
 osg::IntArray *array = ...
 (*array)[i] = 10;

 And the linker says:
 osgd.lib(osg80-osgd.dll) : error LNK2005: "public: int & __cdecl
 osg::MixinVector::operator[](unsigned __int64)" already defined in
 libseFastOsgCored.lib(OsgUniform.obj)

 Any idea ?

 ___
 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
>>
>
>
>
>  --
> trajce nikolov nick
>
>
> ___
> 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
>
>


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


[osg-users] PickHandler doesn't woks well if use an image as background

2013-12-13 Thread Xue Junjie
Hi,

I was using OSG to implementation a node transparency operation. The
PickHandler works fine for me (hit the model using mouse, the node which
was hit change into a transparent node). Then I want to use a sky image
as my background, the code is as follow (i just used the code in
OpenSceneGraph 3 cookbook). And the background works well, too.

Then when i hit my model in the scene, it fail to make the node which i
have hit transparent. Then i added some breakpoints to the code to
tracing the code excuting process. I found in 'nodePath' , the 'geode'
and 'camera' in background are picked first. And whereever i hit on the
screen, the 'geode' and 'camera' will be picked.

Is there any method setting up some intersection masks to the 'geode'
and 'camera' to make my PickHandler work fine?

Thanks for you help in advance.



//using an image as background
void setupBackgroundImage(osg::Group* root)
{
osg::ref_ptr texture = new osg::Texture2D;
osg::ref_ptr image = osgDB::readImageFile( "sky.jpg" );
texture->setImage( image.get() );
osg::ref_ptr quad =
osg::createTexturedQuadGeometry( osg::Vec3(),
osg::Vec3(1.0f, 0.0f, 0.0f), osg::Vec3(0.0f, 1.0f, 0.0f) );
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0,
texture.get() );
osg::ref_ptr geode = new osg::Geode;
geode->addDrawable( quad.get() );

osg::ref_ptr camera = new osg::Camera;
camera->setCullingActive( false );
camera->setClearMask( 0 );
camera->setAllowEventFocus( false );
camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
camera->setRenderOrder( osg::Camera::POST_RENDER );
camera->setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) );
camera->addChild( geode.get() );

osg::StateSet* ss = camera->getOrCreateStateSet();
ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
ss->setAttributeAndModes( new osg::Depth( osg::Depth::LEQUAL, 1.0, 1.0) );

root->addChild(camera);

}


// PickHandler -- A GUIEventHandler that implements picking.
class PickHandler : public osgGA::GUIEventHandler
{
public:

PickHandler() : _mX( 0. ),_mY( 0. ) {}
bool handle( const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa )
{
osgViewer::Viewer* viewer =
dynamic_cast( &aa );
if (!viewer)
return( false );

switch( ea.getEventType() )
{
case osgGA::GUIEventAdapter::PUSH:
case osgGA::GUIEventAdapter::MOVE:
{
// Record mouse location for the button press
// and move events.
_mX = ea.getX();
_mY = ea.getY();
return( false );
}
case osgGA::GUIEventAdapter::RELEASE:
{
// If the mouse hasn't moved since the last
// button press or move event, perform a
// pick. (Otherwise, the trackball
// manipulator will handle it.)
if (_mX == ea.getX() && _mY == ea.getY())
{
if (pick( ea.getXnormalized(),
ea.getYnormalized(), viewer ))
return( true );
}
return( false );
}

default:
return( false );
}
}

protected:
// Store mouse xy location for button press & move events.
float _mX, _mY;

// Perform a pick operation.
bool pick( const double x, const double y,
osgViewer::Viewer* viewer )
{
if (!viewer->getSceneData())
// Nothing to pick.
return( false );

double w( .03 ), h( .03 );
osgUtil::PolytopeIntersector* picker =
new osgUtil::PolytopeIntersector(
osgUtil::Intersector::PROJECTION,
x-w, y-h, x+w, y+h );
picker->setIntersectionLimit(osgUtil::Intersector::IntersectionLimit::LIMIT_NEAREST);


osgUtil::IntersectionVisitor iv( picker );
viewer->getCamera()->accept( iv );

if (picker->containsIntersections())
{
const osg::NodePath& nodePath =
picker->getFirstIntersection().nodePath;
unsigned int idx = nodePath.size();

while (idx--)
{

osg::Node* node = dynamic_cast( nodePath[ idx-1 ] );
if (node == NULL)
continue;


if (_selectedNode.valid())
_selectedNode->setUpdateCallback( NULL );

_selectedNode = node;
//Add Transparent effect
// Create StateSet and Material
osg::StateSet* state2 = _selectedNode->getOrCreateStateSet();

// Set alpha value
//mat2->setAlpha(osg::Material::FRONT_AND_BACK, alphavalue);

state2->setAttributeAndModes( mat2.get() , osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE);

// Turn on blending
osg::BlendFunc* bf = new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA,
osg::BlendFunc::ONE_MINUS_SRC_ALPHA );
state2->setAttributeAndModes(bf);


cout<<_selectedNode->getName()<<" picked successfully..."

Re: [osg-users] osgQT build errors with QT 5.2 on MacOSX 10.9

2013-12-13 Thread Kristofer Tingdahl
Dear Jean-Claude,

I sent in a fix 20 mins ago. If you need it quicker replace the
src/osgQt/CMakeLists.txt file with the attached one.


- K

IF(DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSGQT_LIBRARY)
ELSE()
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF()

SET(LIB_NAME osgQt)
SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})

SET(SOURCES_H
${HEADER_PATH}/QGraphicsViewAdapter
)

IF ( Qt5Widgets_FOUND )
if (Qt5Widgets_VERSION VERSION_LESS 5.2.0)
QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
else()
QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} )
endif()
ELSE()
QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ENDIF()

SET(TARGET_H
${HEADER_PATH}/Export
${HEADER_PATH}/GraphicsWindowQt
${HEADER_PATH}/QFontImplementation
${HEADER_PATH}/QGraphicsViewAdapter
${HEADER_PATH}/QWidgetImage
${HEADER_PATH}/QWebViewImage
)


# FIXME: For OS X, need flag for Framework or dylib
SET(TARGET_SRC
GraphicsWindowQt.cpp
QFontImplementation.cpp
QGraphicsViewAdapter.cpp
QWidgetImage.cpp
${SOURCES_H_MOC}
${OPENSCENEGRAPH_VERSIONINFO_RC}
)

SET(TARGET_LIBRARIES
osgWidget
osgDB
osgUtil
osg
OpenThreads
)

IF(CMAKE_COMPILER_IS_GNUCXX)
# Remove -pedantic flag as it barfs on Qt headers
   STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()

# FIXME: This should work but something with the LINK_WITH_VARIABLES macro is 
not working
#SET(TARGET_LIBRARIES_VARS
#QT_QTCORE_LIBRARY 
#QT_QTGUI_LIBRARY
#QT_QTOPENGL_LIBRARY
#)

IF( QT4_FOUND )
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} 
${QT_QTGUI_INCLUDE_DIR}
 ${QT_QTOPENGL_INCLUDE_DIR} )
SET(TARGET_LIBRARIES
${TARGET_LIBRARIES}
${QT_QTCORE_LIBRARY} 
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
)

ENDIF( QT4_FOUND )

SETUP_LIBRARY(${LIB_NAME})

IF ( Qt5Widgets_FOUND )
qt5_use_modules( ${LIB_NAME} Widgets OpenGL )
ENDIF ( Qt5Widgets_FOUND )
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgQT build errors with QT 5.2 on MacOSX 10.9

2013-12-13 Thread Jean-Claude Monnin
Dear Kristofer,

> I sent in a fix 20 mins ago. If you need it quicker replace the 
> src/osgQt/CMakeLists.txt file with the attached one.
Thanks for the patch. I applied it and can confirm that I could compile osgQT 
with QT 5.2.

The examples "osgQtWidgets" and "osgQtBrowser" run correctly, but "osgviewerQt" 
crashes. Following error is displayed on the console:
Cannot make QOpenGLContext current in a different thread
I haven't looked much into it yet. Is this a know issue? Is osgviewerQt working 
with QT 5.0 or 5.1?

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


Re: [osg-users] osgQT build errors with QT 5.2 on MacOSX 10.9

2013-12-13 Thread Kristofer Tingdahl
Hi,

I have not had time to run yet with OSG/qt5, so I cannot tell. I know I had
similar issues before setting the threadingModel to single-threaded in
qt5.0 over a year ago, but I have no clue if this is related or not.


Best regards,

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