The following gives erratic results - and I was wondering why (whether it would manifest itself as a bug on platforms other than windows - where GraphicsConfiguration objects don't all use the same ColorModel):-
1 2 3 4 5 6 7 8
| Frame f = new Frame(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); gd.setFullScreenWindow(f); gd.setDisplayMode(new DisplayMode(800,600,32,60)); gd.createBufferStrategy(2); GraphicsConfiguration gc = ((Graphics2D)f.getBufferStrategy().getDrawGraphics()).getDeviceConfiguration(); System.out.println(gc); |
sometimes I get :-
1
| Win32GraphicsConfig[dev=Win32GraphicsDevice[screen=0],pixfmt=1] |
othertimes I get :-
1
| Win32GraphicsConfig[dev=Win32GraphicsDevice[screen=0],pixfmt=0] |
I guess pixfmt=0 is the pixelformat for describing the front page of a flipping strategy, I say that because pixfmt=0 is not an option available normally through graphicsDevice.getGraphicsConfigurations().
pixfmt=1 is avaiable through said method, (it is the default GraphicsConfiguration - atleast on my system)
If I use the Frame constructor Frame(GraphicsConfiguration gc), the GC I passed in is the GC i get back from graphics2d.getDeviceConfiguration().
Is it giving indeterminate results, because the front and back buffers in a page flipping strategy have different pixel formats (or atleast, different GraphicsConfiguration objects), and I am randomly geting either the front buffer, or the back buffer. (if this is the case - it seems like a bug in the making :S)
:edit:
btw, this has little relevance to any app. im writing - I'm just trying to figure out exactly what is happening underneath the bonnet [US: hood] of java2d
