|
||||
|
Chapter 7 (Worksheet 7)
Page last edited by Jeppe Revall Frisvad (jerf) 09/10-2017
In Sec. 7.5.6, the code that forms two standard texture objects and assigns the textures to the first two texture units is fine for initialization. After initialization, however, please be aware that all you need to do to switch texture between draw calls is to set the uniform variable in the shader using: gl.uniform1i(gl.getUniformLocation(program, "texture"), 0); or gl.uniform1i(gl.getUniformLocation(program, "texture"), 1); where "texture" is the name of the uniform sampler2D variable in the fragment shader. |
|||