On Mon, Jun 14, 2010 at 5:51 PM, Dorkmaster Flek <[email protected]>wrote:
> 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. > > Thanks for the report. Yes, probably some intify for the x-y derived from parallax should be applied. I will look at this. I have some doubts about if your solution will work when the ScrollingManager instance has .scale != 1.0 , say, 1.11, but when not allowing zoom that can be a good solution. Any chance that you can post a scene demoing the problem ? -- claudio -- 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.
