Hello all, I'm new to the forum, so hello!
I'm relatively new to java gaming programming, especially when it comes to graphics stuff, so apologies if this is a noobish question.
Right now I have a simple program in Full Screen Exclusive Mode that draws a moving rectangle bouncing back and forth horizontally on the screen, but I'm getting extremely bad vertical tear along the left and right sides of the rectangle. I read in multiple places that using a bufferstrategy would automatically handle this problem as long as the capabilities reported flipping as true.When I report the buffer capabilities, it tells me flipping is true, and setting the strategy to PRIOR during creation doesn't give me any errors or anything, but tearing continues. I have posted code where I create the bufferstrategy, and then my drawing method , which is called from a simple game loop that updates the game state then draws the screen. Can you think of what might be causing this tearing issue?
EDIT: forgot to add that the main class is extended from Frame (awt). I also tried with JFrame, same problem.
I'm on a brand new gaming hackintosh (on mountain lion), so I'm thinking it may be a problem with my graphics drivers or something? I have a NVidea GTX680 so I can definitely support flipping... Maybe I'll run my program on my old iMac and see if the same problem persists while I await replies.
Thanks so much in advance for your help,
Here is my bufferstrategy creation
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
bs = this.getBufferStrategy();
And here is my flipping part: I call drawScreen() in a while(true) loop for now. I had some FPS limiting code in but took it out to solve this issue.
public void drawScreen()
Graphics2D g = (Graphics2D) bs.getDrawGraphics();
} while (bs.contentsRestored());