Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

uNiQue0815

problems using X event-queue

This topic is 5850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi ! i want to do some openGL-stuff for linux... for the next step, i need some sort of keyboard/mouse input, so i used X-events for input. now, i'm having some trouble, because X seems not to send a keyboard-event, when i press the key... it's send MUCH later... and when i say MUCH, i mean up to 1/2 minute !! i have compiled the lesson7-tutorial from NeHe, which is also using events for input & i have the same problems, there. it's a spinning cube (spinning, when pressing an arrow-key), and when i hold a key, it starts to spin 10-30 second later... what am i doing wrong ? my mainloop looks like this :
while (!done)
{
  while (XPending(display))
  {
    XNextEvent (display, &event);
    switch (event.type)
    {
      KeyPress:
      {
        // do stuff
        break:
      }
    }
  }
  render();
}
i've also tried 'XEventQueued()', but since the NeHe-tutorial does anything just like me & it does the same weird thing, i don't know, what to do... help ! [edited by - uNiQue0815 on September 16, 2002 12:03:17 PM]

Share this post


Link to post
Share on other sites
Advertisement
I really don''t know if this can help, but try to comment-out all the OpenGL stuff... Some similar problem was with Half-Life with some OpenGL drivers under Win, but when U turned it to D3D or U updated dirvers the problem goned.

Glubo The Mad

Share this post


Link to post
Share on other sites
Glubo : yes... i''ve already noticed, that my problem doesn''t occur, if i don''t init OpenGL... but not using OpenGL isn''t an option for me, because i can''t do OpenGL stuff without OpenGL !
update the drivers ? i have the newest nVidia & GLX.

fukas : i already searched the SDL-code for their event-handling, but i couldn''t find anything (wow... i''ve understood Carmack''s Quake2 code better than SDL !!).

i also had problems using SDL, because it keeps telling me, i don''t have working OpenGL drivers... but that''s not true (except my PC is so-lightning-fast, that it can render Quake3 in 1280x1024 with >50fps !) without OpenGL / accel. ...

any other suggestions ?

Share this post


Link to post
Share on other sites
well, i''ve spent a lot of hours on this problem now & i think i searched the whole www for it. but i found nothing. i don''t think getting event handling to work when OpenGL is initialized is an impossible thing to do... since other programs seem not to have any problems with it...

so what''s the thing, i''m doing wrong ?

no one ?

Share this post


Link to post
Share on other sites
ok... i think i''ve solved the problem...

i needed to make a XSync(display, false); call in the mainloop.
still i''m wondering, why i couldn''t find anything about this in any tutorial / documentation in the whole www.

THIS was just one thing i tried in my last desperate attempts to solve my problem, after reading tons of tutorials, howtos & co !

never seemed programming so poorly documented to me before, now that i''ve started coding for linux...

thx 4 help attempts, anyway !

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You will probably get some surprises if you just copy and paste from tutorials without any understanding of the system. The standard book about Xlib is online here http://capderec.udg.es:81/ebt-bin/nph-dweb/dynaweb/SGI_Developer/XLib_PG/

Share this post


Link to post
Share on other sites
i didn''t just copy & paste some code... mostly (maybe) because i just didn''t find any code to copy & paste from...

no... seriously...

i''ve searched the www for manuals for hours & didn''t find anything useful. the book, you''ve linked is one good book for learning about X, but it didn''t talk about my problem (well, i''ve just been flying over it, since it''s 4:00am, here and i''m really tired...(must go to bed, now...). my problem was, that X seemed not to send events, when they happened, but much later, if OpenGL was initialized... it didn''t happen without opengl. i didn''t find anything about that in the book, nor anything about XSync().

the solution i found, was not copied & pasted from any tutorial... it was more like trial & success

so plz don''t tell me about this stupid ''newbie-copy-and-paste'' clichee... i might be new to linux/X, but i''m not new to programming.

-> it''s hard to understand, when there was no manual to learn from.
(maybe the manual you linked has some text about this... but as i already said... too tired now... gotta read tomorrow...)


thx 4 the link, anyway !

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!