Re: [osg-users] ViewerEventHandlers problem with custom GUIEventHandlers

2007-07-03 Thread Panagiotis Papadakos
Well I modified the osgkeyboard example, and added a StatHandler so that main 
now is:

int main(int , char **)
{
osgViewer::Viewer viewer;

osg::ref_ptrKeyboardModel keyboardModel = new KeyboardModel;

viewer.addEventHandler(new KeyboardEventHandler(keyboardModel.get()));
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setSceneData( keyboardModel-getScene() );

return viewer.run();
}

But still pressing s, presses the s key in the virtual keyboard and also shows 
stats.

I didn't have this problem with osgProducer::Viewer but appeared when I ported 
to osgViewer::Viewer.

On Monday 02 July 2007 21:48, Jeremy L. Moles wrote:
 On Mon, 2007-07-02 at 21:32 +0300, Panagiotis Papadakos wrote:
  Hi Jeremy and thanks for your quick response.
 
  I think you have a point there. But even if I inverse my handler, things
  again do not work. I also tried setting setHandled to true but again
  nothing!

 I looked at the code and StatsHandler works on KEYDOWN; so, just make
 sure your event handler is front of the StatsHandler when  you add it to
 the viewer (either by hand or by calling push_front()) and return true
 on that event and you should be okay. Alternatively, you can call:

   statsHandler-setKeyEventTogglesOnScreenStats()

 ...to change it from S to something else.

  On Monday 02 July 2007 21:04, Jeremy L. Moles wrote:
   On Mon, 2007-07-02 at 20:55 +0300, Panagiotis Papadakos wrote:
Hello everybody!
   
I have an OSGKeyboardEventHandler : public osgGA::GUIEventHandler
keyboard handler, whose handle method returns true when for example
's' is pressed. My problem is  that because I have also added the
osgViewer::StatsHandler to my viewer i also see the stats printed on
my screen! Am I doing something wrong? Thank you.
  
   I would guess that one does key press (perhaps yours), and the other
   release (perhaps StatsHandler). I haven't checked the source to
   confirm, but I bet this is what is happening...
  
   ___
   osg-users mailing list
   osg-users@openscenegraph.net
   http://openscenegraph.net/mailman/listinfo/osg-users
   http://www.openscenegraph.org/

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] ViewerEventHandlers problem with custom GUIEventHandlers

2007-07-03 Thread Panagiotis Papadakos
Thank you Robert! Now everything is Ok!
On Tuesday 03 July 2007 16:18, Robert Osfield wrote:
 Hi Panagiotis,

 The behavior difference you are seeing is down to the osgViewer using
 the Chain of Responsibility Design Pattern for passing on events, the
 just of it is that viewer passes events to all event handlers
 regardless of whether the event has been handled or not.  The approach
 pushes the responsibility for checking to see if the event has been
 handled on to the event handlers themselves.  They can check this via
 the GUIEventAdapter::getHandled() method.  If an event handler returns
 true then the Handled bool is automatically set to true.

 The problem that you have observed arises when an event handler has
 been updated to filter out already handled events, some of the osgGA
 event handles like the camera manipulators had been updated, but not
 all - the osgGA::StatsManipulator and osgViewer::ViewerEventHandlers
 hadn't been updated for 2.0.  I have just gone through these event
 handlers and added in the appropriate code  - mostly checks like:

   if (ea.getHandled()) return false;

 Added to the *::handle(..)  methods.

 With this change your code example:

 int main(int , char **)
 {
osgViewer::Viewer viewer;

osg::ref_ptrKeyboardModel keyboardModel = new KeyboardModel;

viewer.addEventHandler(new KeyboardEventHandler(keyboardModel.get()));
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setSceneData( keyboardModel-getScene() );

return viewer.run();
 }

 Will result in the StasHandler getting events but discarding them as
 they have already been handled by the KeyboardEventHandler.  If
 however, you change the order, then the stats will work and the
 keyboard handler will work as the later doesn't check for
 getHandled().  In this instance this is what you want, and the new
 Chain of Responsibility approach is working as intended giving you the
 flexibility to control how events are handled.

 Robert.

 On 7/3/07, Panagiotis Papadakos [EMAIL PROTECTED] wrote:
  Well I modified the osgkeyboard example, and added a StatHandler so that
  main now is:
 
  int main(int , char **)
  {
  osgViewer::Viewer viewer;
 
  osg::ref_ptrKeyboardModel keyboardModel = new KeyboardModel;
 
  viewer.addEventHandler(new
  KeyboardEventHandler(keyboardModel.get())); viewer.addEventHandler(new
  osgViewer::StatsHandler);
  viewer.setSceneData( keyboardModel-getScene() );
 
  return viewer.run();
  }
 
  But still pressing s, presses the s key in the virtual keyboard and also
  shows stats.
 
  I didn't have this problem with osgProducer::Viewer but appeared when I
  ported to osgViewer::Viewer.
 
  On Monday 02 July 2007 21:48, Jeremy L. Moles wrote:
   On Mon, 2007-07-02 at 21:32 +0300, Panagiotis Papadakos wrote:
Hi Jeremy and thanks for your quick response.
   
I think you have a point there. But even if I inverse my handler,
things again do not work. I also tried setting setHandled to true but
again nothing!
  
   I looked at the code and StatsHandler works on KEYDOWN; so, just make
   sure your event handler is front of the StatsHandler when  you add it
   to the viewer (either by hand or by calling push_front()) and return
   true on that event and you should be okay. Alternatively, you can call:
  
 statsHandler-setKeyEventTogglesOnScreenStats()
  
   ...to change it from S to something else.
  
On Monday 02 July 2007 21:04, Jeremy L. Moles wrote:
 On Mon, 2007-07-02 at 20:55 +0300, Panagiotis Papadakos wrote:
  Hello everybody!
 
  I have an OSGKeyboardEventHandler : public osgGA::GUIEventHandler
  keyboard handler, whose handle method returns true when for
  example 's' is pressed. My problem is  that because I have also
  added the osgViewer::StatsHandler to my viewer i also see the
  stats printed on my screen! Am I doing something wrong? Thank
  you.

 I would guess that one does key press (perhaps yours), and the
 other release (perhaps StatsHandler). I haven't checked the source
 to confirm, but I bet this is what is happening...

 ___
 osg-users mailing list
 osg-users@openscenegraph.net
 http://openscenegraph.net/mailman/listinfo/osg-users
 http://www.openscenegraph.org/
 
  --
  Papadakos Panagiotis
  ___
  osg-users mailing list
  osg-users@openscenegraph.net
  http://openscenegraph.net/mailman/listinfo/osg-users
  http://www.openscenegraph.org/

 ___
 osg-users mailing list
 osg-users@openscenegraph.net
 http://openscenegraph.net/mailman/listinfo/osg-users
 http://www.openscenegraph.org/

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] ViewerEventHandlers problem with custom GUIEventHandlers

2007-07-03 Thread Panagiotis Papadakos
One more question though.
Why we use KEYUP in ViewerEventHandlers.cpp and KEYDOWN in all other handlers?
Why not be consistent?
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] ViewerEventHandlers problem with custom GUIEventHandlers

2007-07-02 Thread Panagiotis Papadakos
Hi Jeremy and thanks for your quick response.

I think you have a point there. But even if I inverse my handler, things again 
do not work. I also tried setting setHandled to true but again nothing!

On Monday 02 July 2007 21:04, Jeremy L. Moles wrote:
 On Mon, 2007-07-02 at 20:55 +0300, Panagiotis Papadakos wrote:
  Hello everybody!
 
  I have an OSGKeyboardEventHandler : public osgGA::GUIEventHandler
  keyboard handler, whose handle method returns true when for example 's'
  is pressed. My problem is  that because I have also added the
  osgViewer::StatsHandler to my viewer i also see the stats printed on my
  screen! Am I doing something wrong? Thank you.

 I would guess that one does key press (perhaps yours), and the other
 release (perhaps StatsHandler). I haven't checked the source to confirm,
 but I bet this is what is happening...

 ___
 osg-users mailing list
 osg-users@openscenegraph.net
 http://openscenegraph.net/mailman/listinfo/osg-users
 http://www.openscenegraph.org/

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] osgText:Text and cursor

2007-05-30 Thread Panagiotis Papadakos
Hi.

I am trying to create a cursor, which should be visible between each letter of 
my osgText:Text. Is there any way to get the position of each letter? Any 
ideas?

Thank you.
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] osgGA and Unicode characters?

2007-05-10 Thread Panagiotis Papadakos
On Thursday 10 May 2007 11:32, Robert Osfield wrote:
 Hi Papadakos,

Hi Robert!
 On 5/10/07, Panagiotis Papadakos [EMAIL PROTECTED] wrote:
  Has anybody used osgGA with Unicode characters?
  It seems that OSG ignores my Greek key buttons.

 osgGA uses ints for key codes so can handle Unicode characters, osgGA is
 just an adaption layer, it doesn't capture events itself so it could well
 be that the windowing integration with it is missing the support you are
 looking for.

 What viewer library are you using?
osgProducer::Viewer.
-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] osgGA and Unicode characters?

2007-05-09 Thread Panagiotis Papadakos
Hi!

Has anybody used osgGA with Unicode characters?
It seems that OSG ignores my Greek key buttons.

Thank you!
-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] Key modifiers.

2007-05-04 Thread Panagiotis Papadakos
Hello everybody!

I would like to use modifier keys in my app, for example Ctrl + Space. But it 
seems that I am unable to make them work. I tried to use ea.getKey() to get 
the key and ea.getModKeyMask() to get the modifier mask. But ea.getKey() 
always return KEY_Control_L, when pressing Ctrl + space, and I never get the 
KEY_Space. What am I doing wrong?

Thank you!
-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] TextBox with osgText

2007-03-02 Thread Panagiotis Papadakos
Hello everybody.
I would like to create a TextBox using osgText, allowing editing. 
Could anybody point to any code example?

Thanks
-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] TextBox with osgText

2007-03-02 Thread Panagiotis Papadakos
Hi. I was thinking of something more complicated. With a cursor running over
the osgText and editing osgText at appropriate position.
I think something like osgConsole, but it seems I can't find it in the net.

Thanks.

On Friday 02 March 2007 13:45, Qasim Mumtaz wrote:
 Hi. Look into osgText Example. Its very straight forward. Come back if you
 got more questions. Hope that helps.
   Mumtaz

 Panagiotis Papadakos [EMAIL PROTECTED] wrote:
   Hello everybody.
 I would like to create a TextBox using osgText, allowing editing.
 Could anybody point to any code example?

 Thanks

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] ossimPlanet meets tiled display

2007-03-02 Thread Panagiotis Papadakos
nsmoose has started a windows framework in CSP.
Take a look if you want.

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] Problem with computeIntersections and DO_NOT_COMPUTE_NEAR_FAR

2007-02-10 Thread Panagiotis Papadakos
I have a problem with computeIntersections, which I am using to see if I pick 
an object or not.

The problem is that it is not working when I set the setComputeNearFarMode to 
DO_NOT_COMPUTE_NEAR_FAR
using the following code and at the same time use anaglyphic stereo.

m_viewer-getCullSettings().setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);

If I set the environmental variable OSG_COMPUTE_NEAR_FAR_MODE to 
DO_NOT_COMPUTE_NEAR_FAR
picking in stereo works as expected. 

Am I missing something?

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] Memory leak in osgText

2007-02-03 Thread Panagiotis Papadakos
Yep,you are right. I sent a patch to Mesa3D.
Hope it is Ok.

On Friday 02 February 2007 12:57, Alberto Luaces wrote:
 Hi,

 if the memory leaked from _mesa_malloc during a glTexSubImage2D call, it
 seems more likely to me that it is a Mesa bug during the discarding of the
 old texture and the compositing of the new one.

 Just my thoughts ;)

 Alberto

 El Viernes, 2 de Febrero de 2007 10:58, Panagiotis Papadakos escribió:
  There seems to be a memory leak in osgText. The output of valgrind it the
  following:
 
  ==4911== 2,700 bytes in 675 blocks are definitely lost in loss record 214
  of 319
  ==4911==    at 0x40234E8: malloc (vg_replace_malloc.c:207)
  ==4911==    by 0x4B6C874: _mesa_malloc (imports.c:79)
  ==4911==    by 0x4B8F130: _mesa_init_teximage_fields (teximage.c:1183)
  ==4911==    by 0x4B73830: _mesa_generate_mipmap (mipmap.c:936)
  ==4911==    by 0x4B9C2CE: _mesa_store_texsubimage2d (texstore.c:3181)
  ==4911==    by 0x4B304E6: r300TexSubImage2D (r300_tex.c:768)
  ==4911==    by 0x4B91B18: _mesa_TexSubImage2D (teximage.c:2696)
  ==4911==    by 0x47CB8E7: glTexSubImage2D (glapitemp.h:1828)
  ==4911==    by 0x44E5221: osgText::Font::Glyph::subload() const
  (Font.cpp:718) ==4911==    by 0x44E8EE4:
  osgText::Font::GlyphTexture::apply(osg::State) const (Font.cpp:570)
  ==4911==    by 0x44FEBD2: osg::State::applyTextureAttribute(unsigned,
  osg::StateAttribute const*) (State:927)
  ==4911==    by 0x44F6595:
  osgText::Text::renderWithPolygonOffset(osg::State, osg::Vec4f const)
  const (Text.cpp:1986)

 ___
 osg-users mailing list
 osg-users@openscenegraph.net
 http://openscenegraph.net/mailman/listinfo/osg-users
 http://www.openscenegraph.org/

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] osg::ref_ptr problem

2007-02-03 Thread Panagiotis Papadakos
Hello.

I have a vector with elements of osg::ref_ptrSubClass, where SubClass 
inherits from baseClass,
and I want to create a vector with elements osg::ref_ptrBaseClass. How can I 
do it?
 
BaseClassVector vec;
SubClassVector::iterator item = m_Items.begin();
for(;item != m_Items.end();++item) {
vec.push_back(*item);
}
G++ throws the following error for this code:
no matching function for call to ‘std::vectorosg::ref_ptrBaseClass, 
std::allocatorosg::ref_ptrBaseClass  
::push_back(osg::ref_ptrSubClass)’

Thanks.
-- 
Papadakos Panagiotis___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Re: [osg-users] osg::ref_ptr problem

2007-02-03 Thread Panagiotis Papadakos
On Saturday 03 February 2007 17:15, Paul Martz wrote:
 I believe the compiler is complaining that ref_ptrBaseClass is a
 different (and incompatible) type from ref_ptrSubClass. Try the following
 and see if it helps.
 vec.push_back( dynamic_castBaseClass((*item).get()) );
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com http://www.skew-matrix.com/
 303 859 9466

Well this is not going to work since we dynamic_cast to BaseClass and not 
osg::ref_ptrBaseClass. I am a bit confused!


   _

 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Panagiotis
 Papadakos
 Sent: Saturday, February 03, 2007 8:07 AM
 To: osg-users@openscenegraph.net
 Subject: [osg-users] osg::ref_ptr problem



 Hello.



 I have a vector with elements of osg::ref_ptrSubClass, where SubClass
 inherits from baseClass,

 and I want to create a vector with elements osg::ref_ptrBaseClass. How
 can I do it?



 BaseClassVector vec;

 SubClassVector::iterator item = m_Items.begin();

 for(;item != m_Items.end();++item) {

 vec.push_back(*item);

 }

 G++ throws the following error for this code:

 no matching function for call to 'std::vectorosg::ref_ptrBaseClass,
 std::allocatorosg::ref_ptrBaseClass 

 ::push_back(osg::ref_ptrSubClass)'

 Thanks.

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] osg::ref_ptr problem

2007-02-03 Thread Panagiotis Papadakos
Yes, it works! Thank you...

On Saturday 03 February 2007 17:57, Paul Martz wrote:
   Try the following and see if it helps.
  
   vec.push_back( dynamic_castBaseClass((*item).get()) );
 
  Well this is not going to work since we dynamic_cast to
  BaseClass and not osg::ref_ptrBaseClass. I am a bit confused!

 You're right, it should be:
   vec.push_back( dynamic_castBaseClass*((*item).get()) );
 Sorry I missed the asterisk. Ref_ptr has a constructor that takes a T* as
 a parameter, so it should work with this change.

 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 303 859 9466

 ___
 osg-users mailing list
 osg-users@openscenegraph.net
 http://openscenegraph.net/mailman/listinfo/osg-users
 http://www.openscenegraph.org/

-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] Memory leak in osgText

2007-02-02 Thread Panagiotis Papadakos
There seems to be a memory leak in osgText. The output of valgrind it the 
following:

==4911== 2,700 bytes in 675 blocks are definitely lost in loss record 214 of 
319
==4911==at 0x40234E8: malloc (vg_replace_malloc.c:207)
==4911==by 0x4B6C874: _mesa_malloc (imports.c:79)
==4911==by 0x4B8F130: _mesa_init_teximage_fields (teximage.c:1183)
==4911==by 0x4B73830: _mesa_generate_mipmap (mipmap.c:936)
==4911==by 0x4B9C2CE: _mesa_store_texsubimage2d (texstore.c:3181)
==4911==by 0x4B304E6: r300TexSubImage2D (r300_tex.c:768)
==4911==by 0x4B91B18: _mesa_TexSubImage2D (teximage.c:2696)
==4911==by 0x47CB8E7: glTexSubImage2D (glapitemp.h:1828)
==4911==by 0x44E5221: osgText::Font::Glyph::subload() const (Font.cpp:718)
==4911==by 0x44E8EE4: osgText::Font::GlyphTexture::apply(osg::State) 
const (Font.cpp:570)
==4911==by 0x44FEBD2: osg::State::applyTextureAttribute(unsigned, 
osg::StateAttribute const*) (State:927)
==4911==by 0x44F6595: osgText::Text::renderWithPolygonOffset(osg::State, 
osg::Vec4f const) const (Text.cpp:1986)

Regards
-- 
Papadakos Panagiotis
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/