LWJGL Forum

Programming => LWJGL Documentation => Topic started by: Anonymous on November 21, 2005, 00:29:40

Title: FSAA Getting started
Post by: Anonymous on November 21, 2005, 00:29:40
Hey there, I just got FSAA working and was rather pleased with myself, so I wanted to share with you all how I did it.

Basically, all you have to do is create a PixelFormat with the desired number of samples per pixel, and then pass that in to Display.create().


PixelFormat pf = new PixelFormat(8, 16, 0, numSamples);
Display.create(pf);


I believe you should also call

GL.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB);

but in my experience FSAA is enabled without this call.

It gets a little more complicated than that because your machine might not support the number of samples you've requested, or it may not support multisampling at all!  Since you can't check the GL extensions before calling Display.create, you have two options:
[list=1]
Title: FSAA Getting started
Post by: breath on November 21, 2005, 00:31:30
Oh hell, looks like I got logged out as I was posting this.
Title: Re: FSAA Getting started
Post by: kristleifur on April 25, 2006, 18:02:35
Thanks for posting that code.

Quote from: "breath"
int trySamples = 4;  // note that this number needs to be a power of 2

For the record:
I hadn't gotten that far in your code and blindly tried 6 samples :) -- my Powerbook runs 6 samples/pixel AA fine.

I think that many cards can do this.

FWIW, it's an ATI Mobility Radeon 9700.

Here's some random technical info from apple.com, I guess it applies to most systems:
http://developer.apple.com/qa/qa2001/qa1268.html
Quote from: "apple.com"
The acceptable values for samples are 2, 4 or 6 currently with VRAM, performance and card capabilities limiting the clients choice.

That seems to be the deal for OS X, then.