@@ -1569,6 +1569,25 @@ export function setTextureFromArray(gl: WebGLRenderingContext, tex: WebGLTexture
15691569 * Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
15701570 * UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
15711571 *
1572+ * UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL, UNPACK_COLORSPACE_CONVERSION_WEBGL
1573+ * are left as is though you can pass in options for flipY, premultiplyAlpha, and colorspaceConversion
1574+ * to override them.
1575+ *
1576+ * As for the behavior of these settings
1577+ *
1578+ * ```js
1579+ * gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
1580+ * t1 = twgl.createTexture({src: someImage }); // flipped
1581+ * t2 = twgl.createTexture({src: someImage, flipY: true }); // flipped
1582+ * t3 = twgl.createTexture({src: someImage, flipY: false }); // not flipped
1583+ * t4 = twgl.createTexture({src: someImage }); // flipped
1584+ * ```
1585+ *
1586+ * * t1 is flipped because UNPACK_FLIP_Y_WEBGL is true
1587+ * * t2 is flipped because it was requested
1588+ * * t3 is not flipped because it was requested
1589+ * * t4 is flipped because UNPACK_FLIP_Y_WEBGL has been restored to true
1590+ *
15721591 * @param {WebGLRenderingContext } gl the WebGLRenderingContext
15731592 * @param {TextureOptions } [options] A TextureOptions object with whatever parameters you want set.
15741593 * @param {TextureReadyCallback } [callback] A callback called when an image has been downloaded and uploaded to the texture.
@@ -2882,6 +2901,22 @@ export function getNumComponentsForFormat(format: number): number;
28822901 * @memberOf module:twgl/textures
28832902 */
28842903export function setDefaultTextureColor ( color : number [ ] ) : void ;
2904+ /**
2905+ * returns the property if set or the corresponding state if undefined
2906+ * @param {WebGLRenderingContext } gl the WebGLRenderingContext
2907+ * @param {TextureOptions } options
2908+ * @param {string } property the name of the property to copy
2909+ * @param {number } pname
2910+ * @return {TextureOptions }
2911+ */
2912+ export function getPackStateOption ( gl : WebGLRenderingContext , options : TextureOptions , property : string , pname : number ) : TextureOptions ;
2913+ /**
2914+ * Copy the options object and apply pack state
2915+ * @param {WebGLRenderingContext } gl the WebGLRenderingContext
2916+ * @param {TextureOptions } options
2917+ * @return {TextureOptions }
2918+ */
2919+ export function copyOptionsAndApplyPackState ( gl : WebGLRenderingContext , options : TextureOptions ) : TextureOptions ;
28852920/**
28862921 * Sets the texture parameters of a texture.
28872922 * @param {WebGLRenderingContext } gl the WebGLRenderingContext
@@ -2967,6 +3002,25 @@ export function setEmptyTexture(gl: WebGLRenderingContext, tex: WebGLTexture, op
29673002 * Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
29683003 * UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
29693004 *
3005+ * UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL, UNPACK_COLORSPACE_CONVERSION_WEBGL
3006+ * are left as is though you can pass in options for flipY, premultiplyAlpha, and colorspaceConversion
3007+ * to override them.
3008+ *
3009+ * As for the behavior of these settings
3010+ *
3011+ * ```js
3012+ * gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
3013+ * t1 = twgl.createTexture({src: someImage }); // flipped
3014+ * t2 = twgl.createTexture({src: someImage, flipY: true }); // flipped
3015+ * t3 = twgl.createTexture({src: someImage, flipY: false }); // not flipped
3016+ * t4 = twgl.createTexture({src: someImage }); // flipped
3017+ * ```
3018+ *
3019+ * * t1 is flipped because UNPACK_FLIP_Y_WEBGL is true
3020+ * * t2 is flipped because it was requested
3021+ * * t3 is not flipped because it was requested
3022+ * * t4 is flipped because UNPACK_FLIP_Y_WEBGL has been restored to true
3023+ *
29703024 * @param {WebGLRenderingContext } gl the WebGLRenderingContext
29713025 * @param {TextureOptions } [options] A TextureOptions object with whatever parameters you want set.
29723026 * @param {TextureReadyCallback } [callback] A callback called when an image has been downloaded and uploaded to the texture.
0 commit comments