.display( GLAutoDrawable d ) only called after initialisation or reshape

Hi everyone,

Newby to Jogl but not to programming and Java.

I’m learning the basics by drawing coordinate axes. My program can already make it appear on the screen so I’m trying to rotate the scene with my mouse and make the axes turn.

I’ve studied many demos. These two especially:
Gears at https://jogl-demos.dev.java.net/
Example 11 at http://www.cs.plu.edu/~dwolff/talks/jogl-ccsc/

They compile and work just fine on my computer. But my attempts at replicating a rotating 3D space keep failing. >:(

This much I know: my axes are drawn only when my program starts and when I reshape the window. My GLEventListener, MouseListener, MouseMotionListener all work and fire when needed. (I detect changes to the mouse’s buttons and when it’s being dragged.)

But .display( GLAutoDrawable d ) is never called when the mouse is being dragged.

Any suggestions?

Thanks. :slight_smile:

Bucky

display is automatically called from an awt-thread. what you should do is to update variables when you mouse is dragged and use them inside the display-loop to update your camera or coordinate system.

Do you set up and start an animator like it is done in the Gears main()-method?

If you look at the api, you can call .display() on a GLCanvas and GLJPanel to start the necessary actions that eventually cause a .display(GLAutodrawable) method to get called. So if you don’t want to use Animator (or FPSAnimator) you can just call that on the GLCanvas/JPanel that you’re using when you want the frame to get updated.

A big thank you to all three of you.

.display is automatic. (One you’ve told it to start.) :o

I was able to make it work with the animator. Will try with lhkbob idea later.

Cheers!

[quote].display is automatic. (One you’ve told it to start.) Shocked
[/quote]
.display() isn’t automatic. .display(GLAutoDrawable) is. I said look at the API, there’s a difference.

In the API for GLAutoDrawable, you find:

void display()
Causes OpenGL rendering to be performed for this GLAutoDrawable by calling display for all registered GLEventListeners.

If you got it to work with Animators, thats great, but this was only so you didn’t mistake what I had said before.