程序代写代做代考 Webgl1ToWebGL2

Webgl1ToWebGL2

WebGL 1 to WebGL 2

In main program

• In Web-util.js ask for context “webgl2” instead of “webgl”

• When defining objects use: Vertex Array Objects

In shaders
• For all shaders, first line must be “#version 300 es” NO SPACES!!

E.g.

• In vertex shader:

attribute —> in 

varying —> out

• In fragment shader:

varying —> in

gl_FragColor —> user defined variable at “location 0”


texture2D() —> texture() // system knows what kind of
texture