List of usage examples for org.lwjgl.opengl GL11 nglTexImage1D
public static void nglTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, long pixels)
From source file:com.samrj.devil.gl.Texture1D.java
/** * Allocates space on the GPU for the image, and then uploads it, linking it * to this texture. After calling, the image may be safely deleted from * memory. Any previous image data associated with this texture is released. * /* w ww . ja va 2s. c o m*/ * Assumes the image has a width and/or height of 1 pixel. * * @param image The image to upload to the GPU. * @param format The texture format to store the image as. * @return This texture. */ public Texture1D image(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."); width = image.width * image.height; int primType = TexUtil.getPrimitiveType(format); int oldID = tempBind(); GL11.nglTexImage1D(target, 0, format, width, 0, dataFormat, primType, image.address()); tempUnbind(oldID); setVRAMUsage(TexUtil.getBits(format) * width); return this; }