Skip to content

Instantly share code, notes, and snippets.

@tonyzzp
tonyzzp / gist:5855327
Last active December 18, 2015 22:29
在java中把图片转换为ByteBuffer(然后导入gl生成texture)
private static int createTexture(final String path) throws IOException {
final BufferedImage img = ImageIO.read(SpriteShootout.class.getClassLoader().getResource(path));
final int w = img.getWidth();
final int h = img.getHeight();
final ByteBuffer buffer = readImage(img);
final int texID = glGenTextures();