Every concave object can be represented by convex triangles. 2011/10/17 elliot <[email protected]>
> I am new to opengl and pyglet. My purpose is to make the landscape > for a side scrolling game I am making. defining the landscape as a > series of points makes sense for my game logic, and making a polygon > of those points to graw the landscape makes sense to me. I've read a > variety of things about how to make polygons. > > the section on modes here seems to say polygons aren't supported. > http://www.pyglet.org/doc/api/pyglet.graphics-module.html > > figure 2-2 here: > http://fly.cc.fer.hr/~unreal/theredbook/chapter02.html > says polygons must be convex. > > if the above is true, how do i make filled shapes with concave > sections? that is, how would I render the profile of a complex > landscape? > > My attempts so far show that concave polygons are possible, but why it > glitches in the way this is does not make sense to me. How do I fix > this? > > http://imgur.com/XrqQo > > this is drawn with > > ngth = len(self.verticies)//2 > pyglet.graphics.draw(ngth, pyglet.gl.GL_POLYGON, > ('v2i', self.verticies)) > pyglet.graphics.draw(ngth, pyglet.gl.GL_LINES, > ('v2i', self.verticies),('c4B', (255, 0, 0, 128) * ngth)) > > where self.verticies is the profile of my landscape and the lower left > and right corners at the beginning and end, respectively. > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" 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/pyglet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" 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/pyglet-users?hl=en.
