LWJGL
May 21, 2013, 11:54:59 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Use LWJGL and Graphics2D  (Read 2322 times)
floyd82
Newbie
*
Posts: 2


« on: September 24, 2011, 04:07:09 »

Hi,

I'm currently developing a game inside a JFrame with java.awt.Canvas and heavy use of java2d (Graphics2D).
But now I find that the swing mouse and keyboard functions are insufficient for my purposes, because it is event based and I want to use polling. Can I use the LWJGL Mouse and Keyboard functions together with my JFrame and java.awt.Canvas?

I already tried using it but got "Display must be created." errors. It seems that I must have a LWJGL display to use the mouse and keyboard. I also found Display.setParent() and AWTGLCanvas, but I can't get it running...

Is it possible to use LWJGL and Graphics2D together?

Thank you very much in advance!
Stefan
Logged
princec
Nerdus Imperius
*****
Posts: 1868



WWW
« Reply #1 on: September 24, 2011, 14:32:02 »

You could just use Jinput. Or really, as you're using AWT anyway, you should find that the event-based system is no more or less effective than polling.

Cas Smiley
Logged

floyd82
Newbie
*
Posts: 2


« Reply #2 on: September 24, 2011, 15:53:12 »

Thanks for your answer!
I'll take a look at jinput...

I had the assumption, that the event based input handling is slower because of a lot of locking to get it thread safe via synchronized {}... With polling no synchronization is necessary and therefor faster (as said, only an assumption)...
Logged
Chuck
Newbie
*
Posts: 42


aka sproingie on freenode


« Reply #3 on: September 25, 2011, 11:17:55 »

LWJGL's polling is synchronized too, but the locks disappear in a single-threaded app (which any swing app is unlikely to be).  I think you'll find just about anything is faster than AWT's input handling though, so JInput should be way more than fast enough.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!