I found the problem :) I needed glEnable(GL_TEXTURE_2D) in the on_draw() function.
On Wed, Oct 10, 2012 at 11:43 AM, Wallace Davidson <[email protected]>wrote: > I have an image that is 64x64 and I'm trying to map it to a quad. However > it is only coming up with white and no sign of the image I am trying to > map. > My code looks like this: > > import pyglet > from pyglet.gl import * > > glEnable(GL_TEXTURE_2D) > > image = pyglet.image.load("redbrick.png") > > rawimage = image.get_image_data() > pitch = rawimage.width * len('RGBA') > data = rawimage.get_data('RGBA', pitch) > > glBindTexture(GL_TEXTURE_2D, texture.id) > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) > glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (image.width), (image.height), 0, > GL_RGBA, GL_UNSIGNED_BYTE, data) > > window = pyglet.window.Window() > > @window.event > def on_draw(): > window.clear() > > glBindTexture (GL_TEXTURE_2D, texture.id) > glBegin (GL_QUADS); > glTexCoord2i (0, 0) > glVertex2i (0, 0) > glTexCoord2i (1, 0) > glVertex2i (64, 0) > glTexCoord2i (1, 1) > glVertex2i (64, 64) > glTexCoord2i (0, 1) > glVertex2i (0, 64) > glEnd () > > pyglet.app.run() > > > Is there something I've left out? It just displays a white square in the > bottom left corner :/ > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/pyglet-users/-/a7L410IWgIUJ. > 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.
