LWJGL
May 23, 2013, 07:11:41 *
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: AWTGLCanvas Trouble (modelviewmatrix nullpointer)  (Read 950 times)
Yohanu
Newbie
*
Posts: 2


« on: April 07, 2010, 11:46:27 »

Hello, i have a pretty big problem related to the modelviewmatrix and an AWTGLCanvas.
"GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, bufferModelviewMatrix);" throws a nullpointer (possibly because of threading issues?)

My problem is that this acts as a "map editor" and whenever i click on the canvas it is supposed to calculate screen to world coordinates. I am not sure how to get around this problem without overdesigning things (implementing a queue and everytime user clicks, add the action to a queue which is executed during the paintloop).

Any hints on how to circumvent this nasty problem? Thank you.
Logged
Rene
Regular nerd
**
Posts: 78


« Reply #1 on: April 07, 2010, 13:46:58 »

Mouse clicks are handled on the EventQueue. All OpenGL calls must be made from the same thread you created the context on.

You could try the following solutions:
 - Calculate transformation matrices yourself (what you should be doing anyway IMHO Wink ), and make the matrix available to your mouse handlers
 - Let OpenGL calculate the matrix using lookAt, translatef, etc., then get the matrix from OpenGL and make it available to your mouse handlers
Logged

When I am king, they shall not have bread and shelter only, but also teachings out of books, for a full belly is little worth where the mind is starved - Mark Twain
Yohanu
Newbie
*
Posts: 2


« Reply #2 on: April 07, 2010, 14:30:53 »

Hah, when you mentioned it i actually realized my erroneus thinking! Thanks Smiley
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!