[osg-users] Inheriting multiple classes

2011-01-30 Thread Mukund Keshav
Hello Everyone,

im pretty new to OSG. Well i tried inheriting Geode and MatrixTransform into a 
class(RotatePyramid) as follows:


Code:
class RotatePyramid : public osg::Geode, public osg::MatrixTransform {

};

osg::ref_ptr pyramidGeode = new RotatePyramid;

int main()
{
  osg::ref_ptr root = new osg::Group;

  ... // code here
  root->addChild(pyramidGeode); // error here
}



Error: 'argument' : ambiguous conversions from 'RotatePyramid *' to 'osg::Node 
*'
Can anyone please suggest how i can rectify this?

Thanks,
Mukund

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





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


[osg-users] Compiler errors

2011-01-30 Thread Werner Modenbach
Hi all,

I get the following error in compilation on Linux:

/osg/osgPlugins/freetype/FreeTypeFont.h:34: Error:‘Glyph’ in class 
‘osgText::Font’ does not name a type

I use a quite new svn version. But to be honest, I import most of the osg 
distribution structure into my project and buid it inside Qt Creator. So I 
think I'm missing some settings usually done in the ./configure part.
The complete osg distribution builds fine with its own build scripts.

Thanks

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


[osg-users] problem with fullscreen

2011-01-30 Thread issam boughanmi
Hi,

i have a little problem if i turn on the fullscreen on :
if i click inside the viewer window my app loose the focus ,
and it happens in any osg app including the demos

any help is welcome

thanks and good day

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





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


[osg-users] setNumMultiSamples not independ to setUpViewInWindow ?

2011-01-30 Thread Heiko Thiel
Hi,

I have wondered me on my project, why antialising, which I had activated, was 
broken. Now I found the resolution, but I don't know why this fixed it.

When I call:


Code:
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );
osg::DisplaySettings::instance()->setNumMultiSamples(4);



it don't works. But if I use 


Code:
osg::DisplaySettings::instance()->setNumMultiSamples(4);
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );



it works. But why? Or is it a bug?

Thank you!

Cheers,
Heiko

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





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


Re: [osg-users] Inheriting multiple classes

2011-01-30 Thread Jean-Sébastien Guay

Hi Mukund,


im pretty new to OSG. Well i tried inheriting Geode and MatrixTransform into a 
class(RotatePyramid) as follows:

Code:
class RotatePyramid : public osg::Geode, public osg::MatrixTransform {

};

osg::ref_ptr  pyramidGeode = new RotatePyramid;

int main()
{
   osg::ref_ptr  root = new osg::Group;

   ... // code here
   root->addChild(pyramidGeode); // error here
}

Error: 'argument' : ambiguous conversions from 'RotatePyramid *' to 'osg::Node 
*'
Can anyone please suggest how i can rectify this?


This is a C++ question. Since Geode and MatrixTransform both inherit 
(indirectly for MatrixTransform) from Node, your derived class has 
Node's members 2 times. In C++, if you *really* want to do this, you can 
do it (I forget if it's with private/protected inheritance or virtual 
inheritance). But I don't recommend you do this. In any case, it 
wouldn't have had the effect you were likely trying to do, which I think 
is that you want a Geode that you can transform. To do this you would 
have had to (at very least) parent the Geode part to the MatrixTransform 
part of your class. And things just get more confusing from there.


In your case, why don't you just make your RotatePyramid class inherit 
MatrixTransform, and have a Geode member whose important methods you'd 
give access to (with simple forwarding members), something like:


class RotatePyramid : public osg::MatrixTransform
{
public:
RotatePyramid(...) : m_geode(new osg::Geode)
{ this->addChild(m_geode); }

void addDrawable(osg::Drawable* drawable)
{ m_geode->addDrawable(drawable); }
unsigned int getNumDrawables() const
{ return m_geode->getNumDrawables(); }
// etc ...

protected:
// Note: No need to store this in a ref_ptr since it will be ref
// counted by the MatrixTransform's children list.
osg::Geode* m_geode;
};

The only drawback I can see with this approach is that you won't be able 
to pass RotatePyramid to functions that take an osg::Geode explicitly. 
But in that case, you can have an asGeode() method in RotatePyramid that 
will return m_geode, and then use that in those cases.


It all comes down to preference and code readability IMHO. If you can do 
the same thing without using less-known features of the language, I 
would personally prefer that route. Unless there are very compelling 
advantages, but in this case I don't see any.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setNumMultiSamples not independ to setUpViewInWindow ?

2011-01-30 Thread Jean-Sébastien Guay

Hello Heiko,


When I call:

Code:
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );
osg::DisplaySettings::instance()->setNumMultiSamples(4);

it don't works. But if I use

Code:
osg::DisplaySettings::instance()->setNumMultiSamples(4);
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );

it works. But why? Or is it a bug?


It's not a bug. Look at the code to 
osgViewer::View::setUpViewInWindow(...) and think about it. That method 
uses the osg::DisplaySettings to do its setup. But once the 
GraphicsContext is created using those settings, it won't take into 
account the fact that you've changed the settings... So if you set the 
multisampling before the creation of the GraphicsContext, it takes 
effect, but if you set it after, it doesn't.


If you want it to be visible whenever you set the multisampling on 
DisplaySettings, you'll have to manually recreate your GraphicsContexts 
(you can call setUpViewInWindow(...) again). This may have some other 
effects though (your models may lose their textures if you had enabled 
autoUnRefAfterApply, for example - search the archives for solutions to 
that).


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [forum] OSG initial setup

2011-01-30 Thread Neil Neilson
Hi,

I am new to OSG.
I have spent a few hours looking at the code and reading posts in the forum.
 
Using the Search function was unable to find the basic instructions to set this 
up with MS VC, EclipseCDT or Upp.

A link to where this can be found would be appreciated.

I have been using NASA WorldWind in Java and previously in C#.
I have been using Ultimate++ for C++ 

Thank you!

Cheers,
Neil

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





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


Re: [osg-users] [forum] OSG initial setup

2011-01-30 Thread Jean-Sébastien Guay

Hello Neil,


I am new to OSG.
I have spent a few hours looking at the code and reading posts in the forum.

Using the Search function was unable to find the basic instructions to set this 
up with MS VC, EclipseCDT or Upp.

A link to where this can be found would be appreciated.


Have you gone to the official web site? Also Google could have helped.

http://www.openscenegraph.org/

On the right side, click Documentation.
Then there are many different pages to read, among them Getting Started.
Then you could go to Platform Specifics, where you'll see a link called 
"Windows - Visual Studio" which will tell you how to set up your 
development environment for MSVC.


That's for building OSG itself though. You could also decide to download 
prebuilt binaries of OSG (see Downloads on the site's main page). Of 
course those will be less up-to-date than binaries you would compile 
yourself from SVN sources.


Note that you'll need to have a build of OSG for the same compiler as 
you'll want to use for your own project. So if you want to use Eclipse 
for example, you'll need to know which compiler it uses (I guess it 
might be mingw-gcc or it could be configured to compile with VC++ 
command line compiler cl.exe). If you want to use Visual Studio then 
you'll need to compile OSG with VC++.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Inheriting multiple classes

2011-01-30 Thread Mukund Keshav
Hi J-S,

Thanks for the reply. Well what i needed was to provide the setMatrix() method 
with a Geometry. i mean to be able to use setMatrix when vertices are 
specified. i was just complicating it.

osg::ref_ptr mt = new osg::MatrixTransform;
mt->addChild(pyramidGeode); // pyramidGeode is a Geode pointer.

PS: Could you please tell me what is wrong with this code:


Code:

int main()
{

// graph created above.
osgViewer::Viewer viewer;

// Set the projection matrix.
viewer.getCamera()->setProjectionMatrixAsFrustum(-2, 2, 

 -2, 2,

  2, 1000);

osg::Node* cow  = osgDB::readNodeFile( "JoeDirt.flt" );

// Cow node
osg::ref_ptr mt = new osg::MatrixTransform;
mt->addChild(cow);
mt->setDataVariance( osg::Object::DYNAMIC );

osg::ref_ptr root = new osg::Group;

// add child
root->addChild( mt.get() );

// set the scene data
viewer.setSceneData( root.get() );

// Set the clear color 
viewer.getCamera()->setClearColor(
osg::Vec4( 0., 0., 0., 1. ) );

double angle = 0;
while (!viewer.done()) {
// Create the rotation matrix.
osg::Matrix rot1, scale1, trans1;

// Set the matrix for the cow.  
 rot1.makeRotate( angle += 0.01, osg::Vec3( 1., 0., 0. ) ); 

 trans1.makeTranslate(osg::Vec3(-2, -2, -500));

 // rotate the model
 mt->setMatrix(rot1 *  trans1); 

// Draw the next frame.
viewer.frame();
}

return 0;
}




The terrain loads and rotates fine. But when it comes to the horizontal plane(0 
degrees), the model vanishes(part of it). What could be the problem?

Thanks, 
Mukund

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





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


Re: [osg-users] [forum] OSG initial setup

2011-01-30 Thread Neil Neilson
Hi,

Thanks for the response.  I have spent a considerable amount of time on this.  
I went thru the steps for EclipseCDT in Win XP more than once several ways.  
/wiki/Support/PlatformSpecifics/MingwColladaEclipse which seems to be outdated.

Eclipse Helios Service Release 1 Build id: 20100917-0705
MinGW-gcc440_1
path has added: C:\mingw\bin;C:\msys\1.0\bin;C:\Program Files\CMake 2.8\bin;

I have tried with:
OpenSceneGraph-2.8.3
OpenSceneGraph-2.9.8-svn-r11201-bin -dev -examples
OpenSceneGraph-2.9.11

Built from source once with Cmake, that does take time.
mingw32-make
mingw32-make install
The second make put bin, include and lib in C:\Program Files\OpenSceneGraph 
even though I specified it to go to C:\OpenSceneGraph

"Note that you'll need to have a build of OSG for the same compiler as
you'll want to use for your own project." 
The pre built  that was downloaded may not have been done with  MinGW-gcc440_1

It would be good if the information on how to install was updated.

I don't know what to try next, I would like to get OSG working.

Thank you!

Neil

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





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


Re: [osg-users] [forum] OSG initial setup

2011-01-30 Thread Neil Neilson
Hi,

When it gets to this step is where a problem is:
"In the "Libraries (-l)" window, click on the "+" icon for each library you 
need. For example, for the "Basic Geometry" tutorial 
(http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry),
 you'll need "libosg" and "libosgViewer"

I can't set Paths and Symbols / Source Location  but they show and I can pull 
them from the Project Explorer window.

Thank you!

Cheers,
Neil

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





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


[osg-users] Changing vertex color for openflight model

2011-01-30 Thread Linda Lee
Hi,

I tried changing the vertex colors for an openflight model using the following 
functions:

osg::ref_ptr colors = new osg::Vec4Array;
int num =  vertex->getNumElements(); 
for (int j = 0; j < num; j++)
colors->push_back(osg::Vec4(0, 0, 0, 1.0f));
geo->setColorArray(colors.get());
geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX);

But it seems to fail.  Just wonder if I am have missed out some important lines 
of codes?

Thank you!

Cheers,
Linda

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





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


Re: [osg-users] [forum] OSG initial setup

2011-01-30 Thread Jean-Sébastien Guay

Hello Neil,


Thanks for the response.  I have spent a considerable amount of time on this.  
I went thru the steps for EclipseCDT in Win XP more than once several ways.  
/wiki/Support/PlatformSpecifics/MingwColladaEclipse which seems to be outdated.


It's possible it's outdated. We rely on people using a particular 
environment to update the information relative to it, since there are so 
many different possible build environments.



Built from source once with Cmake, that does take time.
mingw32-make
mingw32-make install
The second make put bin, include and lib in C:\Program Files\OpenSceneGraph 
even though I specified it to go to C:\OpenSceneGraph


How did you specify that it should put it in C:\OpenSceneGraph? The way 
to do this is to change the CMAKE_INSTALL_PREFIX variable in CMake. I do 
this all the time and it works great for me. Can you show me what your 
CMake window looks like?



"Note that you'll need to have a build of OSG for the same compiler as
you'll want to use for your own project."
The pre built  that was downloaded may not have been done with  MinGW-gcc440_1


Probably not, it's probably a little-used compiler (I guess). On Windows 
the most used compiler is Visual C++ (8.0/2005 or 9.0/2008 at the 
moment). MinGW is a niche compiler, though last time I tried the OSG 
build worked (I submitted a few small changes to make some parts compile 
but most of it compiled correctly out of the box).



It would be good if the information on how to install was updated.


As I said, there are just so many different environments. If you tell us 
what compiler you're using there are more chances someone who's using 
the same one will chime in to give you advice. You mention 
MinGW-gcc440_1, is that what you're using? Also, with MinGW I would 
suggest you use the latest SVN trunk source, it will be the most up to 
date (and contains my patches as well as more recent ones for MinGW 
compilation) plus if you find you need to make changes to get things to 
compile for you, you will be able to submit your changed files and get 
the changes merged into the source so they profit others using the same 
environment as you.



I don't know what to try next, I would like to get OSG working.


Let's start with telling us what doesn't work. Try this:

1. Choose your compiler. Is it MinGW-gcc440_1 as you said?
2. Check out the latest SVN source (see 
http://www.openscenegraph.org/projects/osg/wiki/Downloads/SVN )
3. Run CMake, point it to where you checked out the source, set the 
build directory to some other place (like \build) and 
change CMAKE_INSTALL_PREFIX to where you want the "install" target to 
copy the built files.

4. Build.

Did you have any trouble doing these steps? What went wrong (please give 
us the error messages, anything to help us help you).


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [forum] OSG initial setup

2011-01-30 Thread Jean-Sébastien Guay

Hi Neil,


When it gets to this step is where a problem is:
"In the "Libraries (-l)" window, click on the "+" icon for each library you need. For example, for the 
"Basic Geometry" tutorial (http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry), you'll need 
"libosg" and "libosgViewer"

I can't set Paths and Symbols / Source Location  but they show and I can pull 
them from the Project Explorer window.


Someone who uses Eclipse (I assume you're talking about Eclipse here, 
but you don't say explicitly) will have to help you. I don't use it, so 
I can't say much.


Again, as I said in the other message, please be very clear in your 
messages... Anything you assume we must know about your setup and 
environment, but which we don't actually know, will lead to imperfect 
support from us. So help us help you! :-)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Changing vertex color for openflight model

2011-01-30 Thread Jean-Sébastien Guay

Hi Linda,


int num =  vertex->getNumElements();


What is vertex? Is it a Vec3Array? Did you check the return value of 
vertex->getNumElements() ? I think for a Vec3Array it will return 3 all 
the time - it's the number of elements per item in the array. To get the 
number of items - the number of Vec3s or the number of vertices - you 
should call size() (as for an std::vector, since osg::TemplateArray 
inherits osg::MixinVector which exposes an std::vector interface). But 
I'm not sure about getNumElements(), I generally just use size() so I 
don't remember what it's meant to return actually.


Also, to make your changes visible, if your geometry has display lists 
enabled, you'll need to call geo->dirtyDisplayList(). If you're updating 
the color array (or any array) very often, like once per frame, consider 
turning off display lists, as their generation is a bit slow and if it 
happens too often (triggered by dirtyDisplayList()) it will really slow 
down your frame rate. Display lists are good for when the geometry is 
static and can be reused for many frames.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Changing vertex color for openflight model

2011-01-30 Thread Linda Lee
Hi,

Thank you for your reply and suggestions.  I did what you suggested like using 
geo->dirtyDisplayList() and stuffs.  I think that I did most of it correctly as 
I realized with more debugging that it works only on certain openflight files.  
I suspects that some attributes on the some openflight files are preventing me 
from changing or overriding the vertex colors.  Just wonder if anyone has 
encountered similar problems.

Thank you!

Cheers,
Linda

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





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


Re: [osg-users] Changing vertex color for openflight model

2011-01-30 Thread Jean-Sébastien Guay

Hello Linda,


Thank you for your reply and suggestions.  I did what you suggested like using 
geo->dirtyDisplayList() and stuffs.  I think that I did most of it correctly as 
I realized with more debugging that it works only on certain openflight files.  I 
suspects that some attributes on the some openflight files are preventing me from 
changing or overriding the vertex colors.  Just wonder if anyone has encountered 
similar problems.


Well, if lighting is enabled and there are materials in your statesets, 
those will take effect (in most circumstances). I suggest you take a 
look at the OpenGL GL_COLOR_MATERIAL documentation and GL_LIGHTING 
documentation, as these are things that you will have to look out for. 
OSG is not special in this respect, it's a thin layer over OpenGL so 
those rules will still apply.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org