I was playing with the new parallax parameter of the ScrollableLayer
class in the 0.3.1 beta version, and I noticed that if the parallax
rate is not a whole number (ex. 0.5 or 0.25 in my case), this results
in fractional pixel values for the focal point, which in turn causes
OpenGL to interpolate colours and transparency values between the two
pixels.  This basically leads to graphical glitches around the edge of
the parallax layer by the transparencies in it, which mine has because
it's a sky background with a moon in my case.  I fixed this by
changing these two lines:

x *= self.parallax
y *= self.parallax

To something like this:

x = int(math.floor(x * self.parallax))
y = int(math.floor(y * self.parallax))

So now the effect is that the parallax layer only moves whole pixels
at a time, which fixes the graphical glitches I saw.  I'm not sure if
this is intended functionality, as I know OpenGL technically handles
non-integer values for pixels and maybe Cocos is intentionally trying
to be as agnostic as possible, but I thought I'd share it anyway.

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to