Does page flipping not work in 1.4.1?

I am trying to create a simple BufferStrategy for some drawing tests. I have a class extending JFrame.

getGraphicsConfiguration().getBufferCapabilities().isPageFlipping();

returns true and


createBufferStrategy(3);
getBufferStrategy().getCapabilities().isPageFlipping()

returns false

I have tried it on both an NVidia GeForce2 and an NVidia GeForce4 both running Windows 2000. Does anyone know why GraphicsConfiguration says my hardware support page flipping, but not any BufferStrategies I create? I am running it only in windowed mode and isFullScreenRequired() returns false.

My very simple program is below in it’s entirety. Thanks for any help.


import java.awt.BufferCapabilities;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferStrategy;

import javax.swing.JFrame;

public class BufferStrategyTest extends JFrame
{
      public BufferStrategyTest()
      {
            addWindowListener(new WindowAdapter() 
            {
                  public void windowClosing(WindowEvent e) 
                  {
                        System.exit(0);
                  }
            });
            
            show();
            BufferCapabilities graphicsCaps = getGraphicsConfiguration().getBufferCapabilities();
            System.out.println("Page flipping supported = " + graphicsCaps.isPageFlipping());
            System.out.println("Full screen required = " + graphicsCaps.isFullScreenRequired());
            
            createBufferStrategy(3);
            BufferStrategy strategy = getBufferStrategy();
            BufferCapabilities caps = strategy.getCapabilities();
            System.out.println("Page flipping supported = " + caps.isPageFlipping());
            System.out.println("Full screen required = " + caps.isFullScreenRequired());
      }
      
      public static void main(String[] args)
      {
            new BufferStrategyTest();
      }
}

If I’m not mistaking this is an know bug that getBufferStrategy().getCapabilities().isPageFlipping() returns false on Windows system. Think this topic has been discussed in these forums before, try a search.

PageFlipping is only supported in Fullscreen exclusive mode.

Thanks for the information. I did try to research this both here and on google but came up dry, so I may not have been asking the right question.

Anyway, after messing around and researching a little more, I discovered a few interesting quirks. First, a call to getGraphicsConfiguration().getBufferCapabilities().isFullScreenRequired() returns true, but a call to getBufferStrategy().getCapabilities().isFullScreenRequired() returns false unless I get the GraphicsDevice and set it to full screen, then the BufferStrategy changes it’s mind and indicates that isFullScreenRequired() as true.

Also, like you say, I get the distinct impression that the FlipBufferStrategy was never meant for anything but full screen exclusive mode although they never flat out admit it based on http://java.sun.com/docs/books/tutorial/extra/fullscreen/bufferstrategy.html where they say “For best results, create your buffer strategy on a full-screen exclusive window”. It may be due to the fact that they can’t guarantee windowed page flipping support for all graphics card makers. And apparently NVidia is one of those. Oh well, I have to be able to run in windowed mode, so I guess I’ll have to make due with blitting.

if u use the createBufferStrategy(int numOfBuffers); method you will always get the optimum strategy.

called on a window in fullscreen mode it may use flipping, otherwise, it will be a blitting strategy.