Frame update problems

Maybe yall can help on this one.

I have a small application that does 3D drawing. It opens a file of vertices and triangle faces. The main class instanciates a class I have created as a openGL engine using JOGL which extends FRAME. When this is created it opens it’s own frame to draw on.

When I open the file the polygon’s appear in the frame no problem. However when I do rotates, translates, etc. that are invoked through pubic methods in the GLEngine class nothing happens. That is until I move the frame, as soon as I move it the picture redraws correctly. Each of my public methods does make a call to display and I have verified it is being called.

That all happens on a small set of vertices/faces. If I use an file with lots of vertices and faces (say 2000) everything draws 95% of the time normally (misses one once in a while).

Is there a way to force display to update without moving the frame? I am using glFlush at the end of my display method.

Any hints here would be appreciated. I can send a .jar to anybody who wants to see as well.

Jim

Scratch that part about the large number of vertices/faces working 95% time, that is not the case.

thanks,

Jim

Are you running an Animator (class) on your display?

Kev

I do declare an animator in the consturctor of my GLEngine class:


animator = new Animator(canvas);
animator.start();

How would I know if its is running? From what I am seeing it almost appears as if its not, ie. no updates on frame unless I move it.

Jim

Figured out Animator was not running and this is what was throwing the GLExecption on my other post. Fixed that.

Still have update problems though. The image updates wonderfully if I have a statment such as :

gl.glrotated(5, 1, 0, 0); //rotate 5 degrees on X

but if i do:

if(rotx) {
System.out.println(“Rotate x: omega=” + omega);
gl.glrotated(omega, 1, 0, 0); }

where rotx is a boolean and omega is a double passed in nothing happens. I have system out reporting that rotate x is executed and the omega value is set but not change in output picture.

What am I missing here?

Jim

For reference I figured this out too. Any comments would be interesting.

What i was doing was setting the omega value and then calling display(GLdrawable drawable) myself. This would occur and I would see the system.out indicate as such but no change in the render.

Bottom line is only calls to display from the animator result in an updated render. Any manual calls to display, init, rehsape will result in nothing.

I would love a method of forcing a manual update instead of using animator. Documentation somewhat alludes to this but its not obvious to me (other than just moving the frame itself).

Jim

This behavior is documented in GLDrawable.setRenderingThread, which is called internally by the Animator.

If you want to render a GLDrawable from two different threads you’ll currently have to call GLDrawable.display() yourself from the two threads, and avoid using the Animator.