use FSAA: get sample count

Hi!

I try to use FSAA with the graphics card Nvidia Quadro FX 3450, GL_ARB_multisample is supported but the maximum sample count is 4. How can I get the maximum sample count before creating the canvas?

maybe just create canvas, ask stuff, destroy canvas, create new canvas with new parameters.

If you’re worried about requesting a number of samples that aren’t supported, OpenGL implementations are supposed to choose the highest supported # of samples that’s <= requested #.

Ok so I have nothing to do, thanks ;D

In Slick which uses LWJGL, this is the way Kev Glass does it in the class org.newdawn.slick.AppGameContainer. If there was a better way to do it I assume he’d know about it, so this must be best practice:


		try {
        			PixelFormat format = new PixelFormat(8,8,0,samples);
        			
        			tryCreateDisplay(format);
        			supportsMultiSample = true;
        		} catch (Exception e) {
        			Display.destroy();
        			
        			try {
	        			PixelFormat format = new PixelFormat(8,8,0);
	        			
	        			tryCreateDisplay(format);
	        			alphaSupport = false;
        			} catch (Exception e2) {
	        			Display.destroy();
	        			// if we couldn't get alpha, let us know
		        		try {
		        			tryCreateDisplay(new PixelFormat());
		        		} catch (Exception e3) {
		        			Log.error(e3);
		        		}
        			}
        		}

I have looked at the source code of JOGL. When a canvas is created with a GLCapabilities instance, JOGL checks whether the chosen capabilities are supported; if it is not supported, it uses the default capabilities selection mechanism that chooses the closest GLCapabilities instance among the instances that are supported on the machine. Kev Glass uses a good approach that looks like what is still done in plain C/C++.