On Sun, Oct 17, 2010 at 6:08 PM, Josh Ziegler <[email protected]>wrote:
> # Okay, I should have provided some code the first time around: > # I adapted this from this: > http://www.mail-archive.com/[email protected]/msg03095.html > > import pyglet > > from pyglet.gl import * > > window = pyglet.window.Window(width=800, height=600, visible=False) > > @window.event > def on_draw(): > glClear(GL_COLOR_BUFFER_BIT) > glLoadIdentity() > > glEnable(GL_TEXTURE_2D) > glEnable(GL_COLOR_MATERIAL) > glShadeModel(GL_SMOOTH) > image = pyglet.image.load('pyglet.png') > texture = image.get_texture() > glBindTexture(GL_TEXTURE_2D, texture.id) > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) > > pyglet.graphics.draw(3, pyglet.gl.GL_POLYGON, ('v2i', (10, 15, 30, > 315, 435, 55))) > > fps.draw() > > fps = pyglet.clock.ClockDisplay() > window.set_visible() > pyglet.app.run() > > On Oct 16, 11:25 pm, Josh Ziegler <[email protected]> wrote: > > Apologies if this is a stupid question, but I've been searching this > > group, google and everything in between for answers without figuring > > it out. > > > > I want to draw a 2d polygon with an image texture instead of a RGBA > > value and have it tile as needed. Could someone explain or provide a > > short code snippet? > > > > Thanks in advance! > You need to provide texture coordinates along with each vertex. -- Tristam MacDonald http://swiftcoder.wordpress.com/ -- 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.
