List of usage examples for org.lwjgl.opengl GL11 nglTexSubImage2D
public static void nglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, long pixels)
From source file:com.samrj.devil.gl.Texture2DAbstract.java
License:Open Source License
/** * Overwrites the stored image for this texture with the given image. This * texture must already have allocated storage. * //ww w. j av a 2 s . c o m * @param image The image to upload to the GPU. * @param format The texture format to store the image as. * @return This texture. */ public T subimage(Image image, int format) { if (image.deleted()) throw new IllegalStateException("Image is deleted."); int dataFormat = TexUtil.getBaseFormat(format); if (image.bands != TexUtil.getBands(dataFormat)) throw new IllegalArgumentException("Incompatible format bands."); if (image.width != width || image.height != height) throw new IllegalArgumentException("Incompatible image dimensions."); int primType = TexUtil.getPrimitiveType(format); int oldID = tempBind(); GL11.nglTexSubImage2D(target, 0, 0, 0, width, height, dataFormat, primType, image.address()); tempUnbind(oldID); return getThis(); }