Problems with flicker/artefacts in JOGL (Mac OS X)

Dear All,

I’m writing a 3D application using Java and JOGL to visualise biological networks.
I basically render a graph of nodes (spheres) connected by edges (lines).

The program works great on the Windows machines I’ve tried and on my apple laptop at home.

However, at work on my lovely G5 powermac with an nvidia GeForce FX 5200 I get apalling flicker when
the image is moving.

It’s hard to nail down exactly but it appears that the brightness of lines on the screen appears to change
as the image moves slightly. So all looks well when the image is static but if I make the scene rotate
it looks dreadful.

If I render just a simple cube of glvertexes the corners of the rotating cube look bright, but the middle
of the lines almost fades out to nothing. It looks like some kind of antialiasing artefact, but I can’t reproduce
it on other machines except my work machine.

Here’s an example of the problem, showing that a tiny translation in the scene causes darkening and
blurring of one of the lines: http://www.sanger.ac.uk/Users/aje/dist/example.jpg

http://www.sanger.ac.uk/Users/aje/dist/example.jpg

(You might need to see the image full size to spot the difference).

Can anybody help me out here ?

I’ve tried things like: -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true

Thanks in advance,

Anton

Just to clarify,

I’ve also turned off all anti-aliasing of the image and get the same effect (perhaps even worse),
Single frames all now look perfect but when the scene rotates lines darken and brighten in
strange patterns. The line looks perfect at one angle, then at others it fades to darkness and
back to brightness again.

According to GLcaps double buffering is turned on, but I’m still not sure if it’s a double buffering
issue or antialiasing. As to why it works on other macs fine but not on this one I’m not sure.

Thanks,

Anton

Are you viewing this on an LCD display? I notice they tend to flicker more with high-contrast horizontal edges moving vertically. Eg. just scrolling these forums I can see some edges look horrible.

Are the “other” macs using CRT displays?

Thanks for the advice,

Yes it appears that the ‘poor performance’ is actually blazingly fast 700fps rendering being too fast for my
LCD monitor to cope with.

When I increase the complexity of my rendering the problem goes away.

Thanks for the advice, I might cap the framerate of my application somehow to try and stop this for small
renderings.

Anton

Yes, good idea. There’s really no point rendering faster than the screen refresh rate anyway. Better off saving those extra cycles for doing other things like physics, AI or non-visual processing.

The common way of doing things is to measure
how long your rendering takes. If it takes much
shorter (e.g. 5ms) than your target framerate
(e.g. 60Hz = 16.67ms), then put the thread to sleep
for a percentage (e.g. 80%) of that extra time (16.67 - 5 = 11.67ms)
so the thread wakes up in time to perform the
buffer swap. To measure how long a frame’s
worth of GL calls takes is a separate topic by
itself but usually a glFlush() should do the trick,
so take your measurements before the first
GL call of a new frame and after the glFlush()
call.

.rex