Re: [osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hi! I think I've found the reason of keyboard layout problem in Linux. Executing the debug process, I found where the key code had been lost. The problem was in GraphicsWindowX11::adaptKey function, to be more precise in the following: if (remappedKey 0xff00) { // special keyboard character keySymbol = remappedKey; } else { // normal ascii key keySymbol = keybuf[0]; } if we replace/remove that conditional branch, i.e. use only that: { // special keyboard character keySymbol = remappedKey; } everything works fine :) I couldn't understand the aim of developers, what is that else for, anyway? else { // normal ascii key keySymbol = keybuf[0]; } if remappedKey holds the right value anyway (not only for special keyboard character) Could we send this into OpenSceneGraph Submissions? 2009/5/21 Max Gammer maxgam...@gmail.com: First name - Maxim, last name - Gammer 2009/5/20 Robert Osfield robert.osfi...@gmail.com: Hi ? My previous email I wrote: Hi Gammer? Maximum? Could you sign with your first name please so we know how to address you, thanks. Alas you still didn't sign your name... it's a small thing, but it does make for more congenial communication so please could you sign your post with your first name. 2009/5/20 Maxim Gammer maxgam...@gmail.com: I have looked src/osgViewer/GraphicsWindowX11.cpp and it helped to localise my problem. I printed the debug info with osg::notify in key points of the code and got very interesting results. Here are key points and results: The debugging results do point the adaptKey not coping with the new keyboard layout. I'm afraid I no X11/multi-language experience so can't point to any specific solution here. I'm surprised that others aren't coming across the same issue. Could you try changing your lanaguage to other lanauges such as French/German/Chinese to see what happens in this instance. I guess all might be broken, or perhaps just something specific language support. If it's generally broken then we'll need to look at how to use a different part of X11 to get the keycodes, otherwise we'll need to look at X11 itself why the Russian side is broken. Robert. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Maxim Gammer -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hi! I think I've found the reason of keyboard layout problem in Linux. Executing the debug process, I found where the key code had been lost. The problem was in GraphicsWindowX11::adaptKey function, to be more precise in the following: if (remappedKey 0xff00) { // special keyboard character keySymbol = remappedKey; } else { // normal ascii key keySymbol = keybuf[0]; } if we replace/remove that conditional branch, i.e. use only that: { // special keyboard character keySymbol = remappedKey; } everything works fine :) I couldn't understand the aim of developers, what is that else for, anyway? else { // normal ascii key keySymbol = keybuf[0]; } if remappedKey holds the right value anyway (not only for special keyboard character) Could we send this into OpenSceneGraph Submissions? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
First name - Maxim, last name - Gammer 2009/5/20 Robert Osfield robert.osfi...@gmail.com: Hi ? My previous email I wrote: Hi Gammer? Maximum? Could you sign with your first name please so we know how to address you, thanks. Alas you still didn't sign your name... it's a small thing, but it does make for more congenial communication so please could you sign your post with your first name. 2009/5/20 Maxim Gammer maxgam...@gmail.com: I have looked src/osgViewer/GraphicsWindowX11.cpp and it helped to localise my problem. I printed the debug info with osg::notify in key points of the code and got very interesting results. Here are key points and results: The debugging results do point the adaptKey not coping with the new keyboard layout. I'm afraid I no X11/multi-language experience so can't point to any specific solution here. I'm surprised that others aren't coming across the same issue. Could you try changing your lanaguage to other lanauges such as French/German/Chinese to see what happens in this instance. I guess all might be broken, or perhaps just something specific language support. If it's generally broken then we'll need to look at how to use a different part of X11 to get the keycodes, otherwise we'll need to look at X11 itself why the Russian side is broken. Robert. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hello, I have looked src/osgViewer/GraphicsWindowX11.cpp and it helped to localise my problem. I printed the debug info with osg::notify in key points of the code and got very interesting results. Here are key points and results: case KeyPress: { if (firstEventTime==0) firstEventTime = ev.xmotion.time; Time relativeTime = ev.xmotion.time - firstEventTime; eventTime = baseTime + static_castdouble(relativeTime)*0.001; // _modifierState = ev.xkey.state; osg::notify(osg::INFO)+++ev.xkey.keycode = ev.xkey.keycode std::endl; keyMapSetKey(_keyMap, ev.xkey.keycode); int keySymbol = 0; adaptKey(ev.xkey, keySymbol); getEventQueue()-keyPress(keySymbol, eventTime); osg::notify(osg::INFO)+++key = keySymbol press ! std::endl; break; } results: ey= 97 +++ev.xkey.keycode = 38 +++key = 97 press ! key= 97 +++ev.xkey.keycode = 39 +++key = 115 press ! key= 115 +++ev.xkey.keycode = 40 +++key = 100 press ! key= 100 +++ev.xkey.keycode = 40 +++key = 100 press ! key= 100 +++ev.xkey.keycode = 40 +++key = 100 press ! key= 100 +++ev.xkey.keycode = 64 +++key = 65513 press ! key= 65513 +++ev.xkey.keycode = 50 +++key = 65505 press ! key= 65505 --here I switched the keyboard layout -- +++ev.xkey.keycode = 39 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 40 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 38 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 38 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 25 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 25 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 25 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 25 +++key = 0 press ! key= 0 +++ev.xkey.keycode = 40 +++key = 0 press ! key= 0 I continued my research :). But the next problem I crossed with, was the following function (GraphicsWindowX11::adaptKey). I'm not very competent in Linux coding, and I get confused with conversion into ASCII, because national characters have another ASCII codes. There is an ASCII code before conversion and therу isn't after it. (see output results above). I'd be glad to any help :) void GraphicsWindowX11::adaptKey(XKeyEvent keyevent, int keySymbol) { Display* display = _eventDisplay; unsigned char keybuf[32]; XLookupString( keyevent, (char *)keybuf, sizeof(keybuf), NULL, NULL ); KeySym ks = XKeycodeToKeysym( display, keyevent.keycode, 0 ); int remappedKey = remapX11Key(ks); if (remappedKey 0xff00) { // special keyboard character keySymbol = remappedKey; } else { // normal ascii key keySymbol = keybuf[0]; } } 2009/5/14 Robert Osfield robert.osfi...@gmail.com Hi Gammer? Maximum? Could you sign with your first name please so we know how to address you, thanks. I haven't heard of problems with keyboard mappings under Linux before so don't have any prior knowledge to share, there must be something specific about your setup which isn't supported that others haven't used before. What you'll have to look into is what is happening inside src/osgViewer/GraphicsWindowX11.cpp to see what keyboard events are being generated and follow these to see how they are mapped before passed into the osgGA::EventQueue that is the route into OSG's standard event traversal. Since you're the one that can reproduce the problem, you are also the one best placed to look into what the specific issue is, the best we can do is point your in roughly the right directions to look. Robert. On Thu, May 14, 2009 at 8:31 AM, Maxim Gammer maxgam...@gmail.com wrote: Hello, While porting my program to Linux, I encountered the following error. If the keyboard layout is English (USA) then KeyboardEventHandler works fine. But if it's something else, Russian for example, ea.getKey() always returns zero. (Except system keys F1 - F12 and digits) It's the case for Kubuntu 9.04 and SUSE 11.1 (KDE) In WindowsXP and Vista everything works fine. The usage of KeyboardEventHandler: bool KeyboardEventHandler::handle( const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter us) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN ): { int _key = ea.getKey(); std::cout key= _key std::endl; -- Maxim Gammer ___ 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
Re: [osg-users] change particle sistems life time in run-time
hi! im my code: bool BaseParticleObject::setParticleSetLifeTime(float value) { ptemplate-setLifeTime((double)value); ps-setDefaultParticleTemplate(*ptemplate); return true; } // //osgParticle::Particle* ptemplate; //osg::ref_ptrosgParticle::ParticleSystem ps; 2009/5/20 Iban Arriola ezku...@hotmail.com: Hi, Hi I´m trying to change my particle systems life time in run-time. To do that, I started making a function setUp called once and a function update called every frame. Inside the setUp function I create the particle system: I set the shape, life time, size, mass, initial speed and so on. Code: void setUp(osg::Group *pRoot) { m_ParticleSystem = new osgParticle::ParticleSystem; m_ParticleSystem-setDefaultAttributes(Fire.dds, false, false); m_Geode = new osg::Geode; m_Geode-addDrawable(m_ParticleSystem.get()); mRoot-addChild(m_Geode.get()); m_pSystemUpdater = new osgParticle::ParticleSystemUpdater; m_pSystemUpdater-addParticleSystem(m_ParticleSystem.get()); mRoot-addChild(m_SystemUpdater.get()); m_myParticle = new osgParticle::Particle; m_myParticle-setShape(osgParticle::Particle::QUAD); m_myParticle-setSizeRange(osgParticle::rangef(0.2,0.2)); m_myParticle-setLifeTime(4); m_myParticle-setMass(0.1); m_ParticleSystem-setDefaultParticleTemplate(*m_myParticle); m_Emitter = new osgParticle::ModularEmitter; m_Emitter-setParticleSystem(m_ParticleSystem.get()); osg::ref_ptrosgParticle::PointPlacer mPlacer = new osgParticle::PointPlacer(); mPlacer-setCenter(osg::Vec3(0.0,0.0,0.0)); m_Emitter-setPlacer(mPlacer.get()); m_Program = new osgParticle::ModularProgram; m_Program-setParticleSystem(m_ParticleSystem.get()); Root-addChild(m_Program.get()); } Then in the Update function for each frame I want to change the life time, random rate counter and initial speed. The problem is that I can change the random rate counter and initial speed but I can´t change the life time because the particle disappear (whatever the value I set). Below you can find my code snipet Code: void Update(float speed, float count, float life) { osg::ref_ptrosgParticle::RadialShooter pShooter = (osgParticle::RadialShooter *)_pEmitter-getShooter(); pShooter-setInitialSpeedRange(speed*0.5,speed*0.9); osg::ref_ptrosgParticle::RandomRateCounter pRate = static_castosgParticle::RandomRateCounter * (_pEmitter-getCounter()); pRate-setRateRange(count*1.0,count*1.5); //osgParticle::Particle myParticle = _pParticleSystem-getDefaultParticleTemplate(); //This don't work if there are several particle systems //if I remove the following instruction, the system works properly but without the lifetime functionality. m_myParticle-setLifeTime(life); } Thanks in advance for your help cheers, Iban -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12605#12605 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Maxim Gammer /*** BaseParticleObject.cpp - îïèñàíèå êëàññà èñòî÷íèêà ÷àñòèö --- begin: 24 àïðåëÿ 2009 copyright: (C) 2009 by Ãàììåð Ìàêñèì Äìèòðèåâè÷ (maximum2000) email: gammer...@yandex.ru ***/ #include ./BaseParticleObject.h //êîíñòðóêòîð BaseParticleObject::BaseParticleObject(std::string Name, osg::ref_ptrosg::Group _root) { //Çàïîìèíàåì ññûëêó íà root root = _root; //çàäàåì èìÿ setName (Name); //Particle ptemplate = new osgParticle::Particle(); ptemplate-setLifeTime(3);// 3 seconds of life ptemplate-setSizeRange(osgParticle::rangef(0.75f, 3.0f)); ptemplate-setAlphaRange(osgParticle::rangef(0.0f, 1.5f)); ptemplate-setColorRange(osgParticle::rangev4( osg::Vec4(1, 0.5f, 0.3f, 1.5f), osg::Vec4(0, 0.0f, 0.0f, 0.0f))); // these are physical properties of the particle ptemplate-setRadius(0.05f);// 5 cm wide particles ptemplate-setMass(0.05f);// 50 g heavy //ParticleSystem ps = new osgParticle::ParticleSystem; ps-setDefaultAttributes(, false, false); // assign the particle template to the system. ps-setDefaultParticleTemplate(*ptemplate); //emitter emitter = new osgParticle::ModularEmitter; //Ïî çàìå÷àíèÿì Àññåëü... //Óãëû âûëåòå ÷àñòèö //RadialShooter shooter = new osgParticle::RadialShooter(); emitter-setShooter (shooter.get()); float k =64.0f; float k2 =4.0f; shooter-setPhiRange (-0.05f*k
[osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hello, While porting my program to Linux, I encountered the following error. If the keyboard layout is English (USA) then KeyboardEventHandler works fine. But if it's something else, Russian for example, ea.getKey() always returns zero. (Except system keys F1 - F12 and digits) It's the case for Kubuntu 9.04 and SUSE 11.1 (KDE) In WindowsXP and Vista everything works fine. The usage of KeyboardEventHandler: bool KeyboardEventHandler::handle( const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter us) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN ): { int _key = ea.getKey(); std::cout key= _key std::endl; -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT integration problem
Thanks! 13 мая 2009 г. 17:15 пользователь Sergey Kurdakov sergey.fo...@gmail.com написал: Hi Maxim. BTW - in order everyone can address you properly, make some effort which makes it easier. example - do not use Cyrillic letters in mail header - it is not russian mail list. Next - sign so that is was clear what is your name and what is your surname. as you could see from your sign it follows that your name is Gammer. I call to you as here maintainers try to keep a special developer atmosphere. So too much impersonal mails harms discussions. Спасибо за понимание. Regards Sergey On Wed, May 13, 2009 at 11:02 AM, Максим Гаммер maxgam...@gmail.com wrote: Hi. There is a problem of my program and QT integration. Problem occurs when I'm trying to use OSG ModularEmitter for particle creation. In process of compilation I get the following: ... /usr/local/include/ osgParticle/ModularEmitter:89: error: expected unqualified-id before 'double' ... ModularEmitter, line 89 : virtual void emit(double dt); I think the problem is in the name of method virtual void emit(double dt), because emit is a preprocessor word in QT, (like slot, signal, emit...) Any ideas how could I compile my project? ) -- Gammer Maxim TSOGU, Tyumen, Russia ___ ___ 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] QT and ModularEmitter (((
Thanks! 2009/5/13 Antonin Linares antonin.lina...@onera.fr: Hi Gammer I v' the same trouble few day ago, i solved it by add -DQT_NO_EMIT to the compilation flags. cheers, Antonin Linares Максим Гаммер a écrit : Hi List. Problem QT and OSG ModularEmitter make ... ... /usr/local/include/osgParticle/ModularEmitter:89: error: expected unqualified-id before ‘double’ ... ModularEmitter, line 89 : virtual void emit(double dt); emit - preprocessor word in QT (slot, signal, emit ...) How can I make my project? ) -- Gammer Maxim TSOGU, Tyumen, Russia ___ 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] OSG and QT integration problem
Thanks! 13 мая 2009 г. 18:08 пользователь Maxim Gammer maxgam...@gmail.com написал: Thanks! 13 мая 2009 г. 17:15 пользователь Sergey Kurdakov sergey.fo...@gmail.com написал: Hi Maxim. BTW - in order everyone can address you properly, make some effort which makes it easier. example - do not use Cyrillic letters in mail header - it is not russian mail list. Next - sign so that is was clear what is your name and what is your surname. as you could see from your sign it follows that your name is Gammer. I call to you as here maintainers try to keep a special developer atmosphere. So too much impersonal mails harms discussions. Спасибо за понимание. Regards Sergey On Wed, May 13, 2009 at 11:02 AM, Максим Гаммер maxgam...@gmail.com wrote: Hi. There is a problem of my program and QT integration. Problem occurs when I'm trying to use OSG ModularEmitter for particle creation. In process of compilation I get the following: ... /usr/local/include/ osgParticle/ModularEmitter:89: error: expected unqualified-id before 'double' ... ModularEmitter, line 89 : virtual void emit(double dt); I think the problem is in the name of method virtual void emit(double dt), because emit is a preprocessor word in QT, (like slot, signal, emit...) Any ideas how could I compile my project? ) -- Gammer Maxim TSOGU, Tyumen, Russia ___ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Гаммер Максим Дмитриевич Начальник отдела ИТ НИИ ЭОР -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] KeyboardEventHandler and native keyboard layout bug in Linux
Hello, While porting my program to Linux, I encountered the following error. If the keyboard layout is English (USA) then KeyboardEventHandler works fine. But if it's something else, Russian for example, ea.getKey() always returns zero. (Except system keys F1 - F12 and digits) It's the case for Kubuntu 9.04 and SUSE 11.1 (KDE) In WindowsXP and Vista everything works fine. The usage of KeyboardEventHandler: bool KeyboardEventHandler::handle( const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter us) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN ): { int _key = ea.getKey(); std::cout key= _key std::endl; -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org