los-cocos / cocos

graphic library for games and multimedia, for python language on PC-like hardware
http://los-cocos.github.io/cocos-site/
Other
632 stars 146 forks source link

ColorLayer position is wrong (with fix) #106

Closed ccanepa closed 10 years ago

ccanepa commented 10 years ago

From kcfelix on October 03, 2008 11:44:21

On the on_enter method of the color layer, the vertex buffer is created relative to the it's position:

x, y = self.width, self.height ox, oy = self.position

    self._vertex_list = self._batch.add(4, pyglet.gl.GL_QUADS, None,
        ('v2i', ( ox, oy,
                  ox, oy + y,
                  ox+x, oy+y, 
                  ox+x, oy)),
        'c4B')

BUT, on the draw method the transform is applied by an opengl matrix causing the vertex list to be drawn with twice the offset given by position

Changing

ox, oy = self.position

to

ox, oy = (0, 0)

fixes the problem :)

Original issue: http://code.google.com/p/los-cocos/issues/detail?id=106

ccanepa commented 10 years ago

From lucio.to...@gmail.com on October 07, 2008 19:57:45

fixed on commit cc374b2

Status: Fixed