Hi,
My game handle his own backBuffer covering a whole gameArea, bigger than the screen. Differents cameras holds a Poition in the game’s coordinates, a position on the screen and Dimension.
The gameArea is horizontally infinite, thats means when you reach right edge, you reappear on the left one. Its true for camera also, so when a camera cover an area that go farther than the right edge, its splitted in two. A method “Map<Rectangle2D, Rectangle2D> getGameAndScreenBounds()” returns mappings between rectangle2Ds representing the covered ingame area, entirely contained on the BackBuffer, and rectangle2Ds representing the screen’s area on wich to draw the former one.
On the rendering loop, for each ingame rectanlges of each Camera, i clear the backBuffer with black and i draw sprites contained in the area.
Then, i draw the backBuffer on the screen by clipping the BufferStrategy’s graphics2D to the camera’s screen Rectangle2D and setting an AffineTransform to translate the buffer so the right game area is drawed.
This works well, but somthimes on the right edge of the camera’s screen rectangle, ive got a 1-pixel wide vertical bar of white pixels (not covering the entire hieght of the rect). As i can switch to fullscreen (it seems it doesn’t work for me, vm crash, bug reported), and i don’t have vsync in windowed mode, i wonder if thats might be due to not vsyncing or more likely by a loss of precision?
All my Rectanlge2D use double value. I cast them to int using Math.floor and Math.ceil to be sure each pixel that might be visible is cleared. All my drawImage() calls use AffineTransforms. Clipping is set with setClip(Rectangle2D rect);
A screenshot showing the problem : http://imagebin.ca/view/E9gQNHxa.html
The screen is filled with red before copying the backBuffer for each camera.
Notice the white line in the lower right corner.
Thanks,
Charly