LWJGL Forum

Programming => OpenGL => Topic started by: wmjoers on July 07, 2005, 15:08:49

Title: Multisampling example?
Post by: wmjoers on July 07, 2005, 15:08:49
Hi,

Are there any examples on how to accomplish antialiasing using LWJGL?

I know that the best approach is to use multisampling but can't find any examples. I read in another thread about using PixelFormat (I guess in Display.create(...)) but I don't know what parameters I should use when creating the PixelFormat object.

I guess I also must enable something with glEnable(...) but I don't know what..
Title: hmmmmmm....
Post by: Fool Running on July 07, 2005, 15:24:07
Just pass a value greater than 0 to the PixelFormat constructor in the samples parameter:
Code: [Select]
PixelFormat(bpp, alpha, depth, stencil, 4) ;
would do 4x( :? ) anti-alaising
Title: Need some more input...
Post by: wmjoers on July 07, 2005, 18:31:52
Oki, thanks!

But...not to be a pain...how do I determine what to put in the other parameters?

Ok...I will make an effort to guess:
* bpp - should be the same as the display modes bits per pixel?
* alpha - could be zero if I don't intend to use alpha??
* depth - little lost here...though....
* stencil - can also be zero if I don't intend to use that??
Title: hmmmm....
Post by: Fool Running on July 07, 2005, 23:25:22
*bpp - can be 16 or 32 (maybe 24 for linux). If you are windowed then use the bpp of the current mode, else pick one  :lol:
*alpha - can be 0 if you don't use alpha
*depth - the number of bits for the depth buffer (used to keep things drawn last from appearing on top of things that are drawn first) 16 or 24 (possibly 8, but seems useless  :wink: )
*stencil - can be 0 if not using the stencil buffer
Title: Multisampling example?
Post by: Orangy Tang on July 08, 2005, 00:05:36
General cavets with the above:
- Num samples should probably be power-of-two (although anything above 4 is likely to be overkill anyway)
- You can only really have 0 or 8 for alpha and stencil
- You can only get 8 bits of alpha with 24 or 32 bit colour
- Non-zero stencil buffer will probably require depth buffer to be greater than 16
- Depth buffer should be equal or less than colour

These are lagely due to the fact that most graphics cards like to interleave the colour with alpha, and also the depth with stencil bits.