Advertisement
cardel

Untitled

Sep 8th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. img = Image.open(name)
  2. img_data =numpy.array(list(img.getdata()), numpy.uint8)
  3.  
  4. id = glGenTextures(1)
  5. glPixelStorei(GL_UNPACK_ALIGNMENT,1)
  6. glBindTexture(GL_TEXTURE_2D, id)
  7. glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
  8. glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
  9. glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
  10. glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
  11.  
  12. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img.size[0], img.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, img_data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement