How can I improve jogl's performance?

Hi, people.

I’m using jogl in 3d animation, but when the object 3D makes a movement, the animation isn’t perfect. There are some “holes” on the object during the movement. How I have an GeForce 7300, i guess the problem is on the jogl’s configuration or on my code.

I put in attach an file with the result of my animation.

These kinds of bugs simply cannot be caused by JOGL.

The bug is in your code, so it’s in your direct control, which is nice…

Goodluck fixing!

The holes somewhat resemble errors with the zbuffer. To fix this make sure that your ratio of z_far to z_near isn’t too large when setting up the camera/viewport and make sure that z_near isn’t too close to 0.
Otherwise it’s a bug in your animation code and you’re moving polygons incorrectly.

I agree that the zbuffer is at fault here…

I have a demo/test program from another post where you can see the same issues if you change the near and far plane distances…especially if you move the far plane out very far you will see that stuff in the scene.

TestRotations.jnlp Try it out…pressing ‘Q’ through ‘U’ on the keyboard line changes the far clip plane from 100 to 100000000. Changing ‘A’ through ‘J’ on the keyboard line changes the near clip plane from 5.0 to 0.000005. When you run it, press the ‘4’ or ‘5’ key to move the scene out a little farther (ie the Earth will be more visible) and rotate the view a bit and then change the far clip plane to a larger value and you will see the same issue.

My problems continue. I have a class called Renderer that extends GLCanvas. In the method initialize(), I put glClearDepth(1.0f), and after your posts, i put 5.0f, but it doesn’t work.

I’m not sure if the problem is on my code because when I use simple models or the time between the execution of two frames is bigger, the holes disappear or its quantity becomes smaller.

Also, if I execute an frame by each time, there is not problem. The holes appear exactly when I animate the model.

Thanks for your suggestions.

clear depth wouldn’t be the problem, it’s the ratios between your near and far clipping planes, which are specified when you set your projection matrix (probably using gluPerspective, or glOrtho). If it’s only happening when animating your models, there is a high chance that it’s something you’ve done wrong in the animation. We can’t help with that unless you tell us how you animate it.

Changing vertices in 1 thread, and rendering in another?

Yes. I have a thread that changes the vertice’s position and another thread shows the model. When I change the vertice’s position, I stop the animation and, after all vertices are updated, I show the model on the screen.

I do not put my code because it is complex and I can’t explain it in few words.

So you are probably having a threading problem here. Are you sure you correctly locked the memory accesses from the different threads (by using a mutex or making the involved methods synchronized)? If not you will get this king of unexpected behaviour due to half updated buffers and some tricky stuff like stale data in the CPU caches.