PixelFormat problem

Started by fazekaim, August 15, 2009, 07:59:35

Previous topic - Next topic

fazekaim

Hello,

I would like to turn on FSAA, but my code doesn't work at all. The code is using VBO, FBO, etc. but fsaa cannot be made work.
Here is my code:
public Screener( String title,
            int width, int height, int[] refreshRates, int bitDepth,
            boolean fullscreen, int fsaa
    ) {
        this.width = width;
        this.height = height;
        ratio = width * 1.0f / height;

        try {
            DisplayMode[] modes = Display.getAvailableDisplayModes();
            DisplayMode chosenMode = null;
            for (int i=0;i<modes.length;i++) {
                if (
                    (modes[i].getWidth() == width) && (modes[i].getHeight() == height) &&
                    (modes[i].getBitsPerPixel()== bitDepth) && (MathReckoning.isInSet( modes[i].getFrequency(), refreshRates) )
                ) {
                    chosenMode = modes[i];
                    break;
                }
            }
            if( chosenMode == null ) throw new LWJGLException( "No proper displaymode found." );

            Display.setDisplayMode(chosenMode);
            Display.setTitle( title );
            Display.setFullscreen( fullscreen );

            if( fsaa > 0 ){
                PixelFormat pf = new PixelFormat().withDepthBits( bitDepth ).withSamples( fsaa ).withSRGB(true);
                Display.create( pf );
            }
            else{
                Display.create(  );
            }

            drawable = Display.getDrawable();
        } catch(LWJGLException e){
            e.printStackTrace();
            Sys.alert("Error", "Unable to determine display modes.");
            System.exit(0);    
        }
    }


Could anyone help me?
How can i test if a pixelformat with a proper setting is available? Display modes can be retrieved i know and what about pixelformats retrieving? Is it possible?

broumbroum

Hi ! openGL depth bits is not your displaymode depth bits. I use 8 bits for openGL depth in a widthxheightx32 bits mode.

fazekaim

I put this line into my code:
PixelFormat pf = new PixelFormat().withDepthBits( 8 ).withSamples( fsaa );

Result is the same. :(

I ran open extensions viewer and it declares that
"max samples: 0
max sample buffers: 0
multisampling: false"

I think this intel gma3100 is the guilty in this mac. :(

Where can i retrieve this information from?
The
"ContextCapabilities cap = GLContext.getCapabilities();
        System.out.println(" " + cap.GL_ARB_multisample );"
is not a good solution. Display must be created before calling it, and i need to know if fsaa is avaiable before calling the Display.create() method.

Trying to create it with fsaa and in the catch case, calling it without fsaa is not a nice solution i think ...

Matzon

maybe you can query this information using a PBuffer first.

fazekaim


elias4444

You can also surround your Display calls with a try-catch statement for when these things happen. If it catches an exception then you know the mode wasn't supported, and you can reinitialize to a simpler mode. Intel graphic chips typically don't support FSAA very well (if at all).
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com