WebGL Textures & Vertices

Beginner's Guide

Page Seventy Two

WebGL API pixelStorei(Number, boolean)

Step 5 the WebGL method pixelStorei(Number, boolean) instructs the processor regarding how to store pixel data. Method pixelStorei(Number, boolean) explains how to arrange the data. The first parameter is a WebGL constant. UNPACK_FLIP_Y_WEBGL maps the top most part of an image to T = 1.0. In other words the values along the Y axis of an image reverse. The second parameter must equal true to flip the data. The following listing demonstrates use of pixelStorei(Number, boolean) to reverse values along the vertical axis.

gl.pixelStorei
(
 gl.UNPACK_FLIP_Y_WEBGL, 
 true
);

Listing 72: WebGL API pixelStorei(Number, boolean)

WebGL Beginner's Guide Introduction WebGL Beginner's Guide
Copyright © 2015 Seven Thunder Software. All Rights Reserved.