@@ -1569,6 +1569,25 @@ export function setTextureFromArray(gl: WebGLRenderingContext, tex: WebGLTexture
1569
1569
* Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
1570
1570
* UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
1571
1571
*
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
+ *
1572
1591
* @param {WebGLRenderingContext } gl the WebGLRenderingContext
1573
1592
* @param {TextureOptions } [options] A TextureOptions object with whatever parameters you want set.
1574
1593
* @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;
2882
2901
* @memberOf module:twgl/textures
2883
2902
*/
2884
2903
export 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 ;
2885
2920
/**
2886
2921
* Sets the texture parameters of a texture.
2887
2922
* @param {WebGLRenderingContext } gl the WebGLRenderingContext
@@ -2967,6 +3002,25 @@ export function setEmptyTexture(gl: WebGLRenderingContext, tex: WebGLTexture, op
2967
3002
* Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
2968
3003
* UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
2969
3004
*
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
+ *
2970
3024
* @param {WebGLRenderingContext } gl the WebGLRenderingContext
2971
3025
* @param {TextureOptions } [options] A TextureOptions object with whatever parameters you want set.
2972
3026
* @param {TextureReadyCallback } [callback] A callback called when an image has been downloaded and uploaded to the texture.
0 commit comments