Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Andreas Umbach, posted on July 18, 2000

Image Description, by Andreas Umbach

The image shows a scene from my lightcycle game, GLtron. Its sole purpose is to show off just how good transparent quads can look when you sort them correctly (i.e. draw them back-to-front). However, it also shows how badly non-anti-aliased lines can look (if anybody has advice on drawing anti-aliased lines in OpenGL that works with most graphics cards, send them my way!).

The code for transparency sorting is not yet in the CVS version of GLtron, but will be in a few days.

Andreas Umbach

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

July 18, 2000, 12:55 AM

You get all the style points for your choice of theme, Andreas.

Why not draw the lines as thin rectangles, so the triangle rendering engine will take care of the anti-aliasing (assuming it supports it...).

Nice job, esp. the light cycle.



July 18, 2000, 01:41 AM


"You get all the style points for your choice of theme, Andreas."

He he, are you still lamenting the Tron source code you lost on the 8086?


Alex J. Champandard

July 18, 2000, 04:26 AM

or you just just do something like this:

glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
glBegin( GL_LINE_STRIP );
// draw your lines

But i think you'll find your major problem there is the zbuffer (as part of your lines are actually not drawn).



July 18, 2000, 06:31 AM

hi, i first played the game when i bought the ct'
two or three weeks ago.
i think your game rocks but you should plan for a splitscreen
or network support because the multiplayer part suffers a great
deal from the "one player view"

Andreas Umbach

July 18, 2000, 08:21 AM

Regarding slit-screen:

Quote from the documentation:

'F1': Single player view
'F2': Two player view
'F3': Four player view


Andreas Umbach

July 18, 2000, 10:29 AM

comment on the dithering:

The picture was taken at 16bit color, 1024x768.
Then (because it was huge), I dithered it to 8bit and
accidently deleted the original. It still looked ok though.
However, if you scale a dithered image, (as was done here),
things start to get AWFUL.

comment on the line aliasing:
most of the artefacts you see here turned out to be z-buffer
problems (as mentioned in a comment). Looks like glPolygonOffset
didn't do the job (or I'm chosing the wrong offsets).


July 18, 2000, 10:37 AM

The image above probably looks worse than it needs to.. While I think we're all aware of the evils of aliased lines in GL, that's not the original screenshot and it shows:

[07:26] <gltron> the picture has taken 16bit at 1024x768
[07:26] <gltron> then dithered to 256 colors
[07:26] <gltron> then someone decided to scale it
[07:26] <gltron> DO NOT scale dithered images
[07:27] <knghtbrd> well it looks like it came out of a 3dfx card =)
[07:27] <knghtbrd> you have the original ?
[07:28] <gltron> nope, accidently deleted it

Too bad, I'd have offered a link to the full-size PNG . =)

Andreas Umbach

July 18, 2000, 10:41 AM

Ok, REAL shots (at 1024x768) are at

250 kb / 200 kb each.

No more z-Buffer problems, but still aliases lines & polygons.

- Andreas


July 18, 2000, 12:50 PM

Alex, the thing is, most OpenGL cards don't support GL_LINE_SMOOTH, which is what he was getting at.

What I'd do to at least fake anti-aliased lines is to draw the same line twice, once with a thickness 0.5 more than the actual thickness (and an alpha of 0.5) and then once with a thickness 0.5 less (and an alpha of 1.0). It wouldn't look properly anti-aliased, but at least it'd be slightly less jaggy without much of a speed hit.


July 18, 2000, 12:56 PM

Oh, duh, just thought of another thing you can do... Create a texture which is, say, 16x16 in the LA format (GL_LUMINANCE4_ALPHA4 or something), where the inner 8 pixels are opaque white and the outer 8 pixels are transparent white, then generate all 4 mipmap levels (I'd just use gluBuild2DMipmaps()), then just texturemap a quad which is twice as wide as the line with the texture coordinates going between (0,0) and (1,1) on opposite corners. :) Then you can still use glColor*() to specify the color (set your texture environment to GL_MODULATE, of course), and you also get the nice side effect of being able to put a gradient on your line width (by varying the width of the quad).


July 18, 2000, 05:03 PM

Why don't you draw your opaque objects first and then draw your transparent objects with z-buffer read-only? You won't have to sort your transparent quads.(tech from the redbook and it works fine with my simple particle system)


July 18, 2000, 05:05 PM


I've had many fun hours playing this game against my friends (I actually happened across your url a few weeks ago by accident and I'm surprised to see this screenshot here)

Keep up the good work. Needs a way to edit levels though :)

This thread contains 12 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.