Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Loss of precision or just not VSynched?  (Read 1545 times)
0 Members and 1 Guest are viewing this topic.
Offline cghislai

Junior Newbie





« Posted 2008-12-23 16:37:16 »

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
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Elsealabs (14 views)
2014-12-28 10:39:27

CopyableCougar4 (18 views)
2014-12-28 02:10:29

BurntPizza (21 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (96 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!