WebGL

2

git@forge.ing.he-arc.ch:inf/1718/infographie/webgl2.git

By Johnny Da Costa

Nouveauté de webGL2

ECMAScript 2015

uniform sampler2D uColorTexture;

in vec3 vNormal;
in vec2 vTextureCoord;
in vec3 vLightRay;

out vec4 color;
uniform sampler2D uColorTexture;

attribute vec3 vNormal;
attribute vec2 vTextureCoord;
attribute vec3 vLightRay;

varying vec4 color;

WebGL

2

WebGL

1

Mise à jour du code

function changeProjectionMode() {
    if (withPerspective) {
        withPerspective = 0
    } else {
        withPerspective = 1
    }
}

Optimisation du code

function changeProjectionMode()
{
    withPerspective ^= 1;
    //withPerspective = 1 - withPerspective; 
}

Optimisation du code

Tools

Un seul carré, mais le tout dessiné dans le Fragment Shader

Modélisation d'une série de triangles bleus avec interpolation linéaire pour générer les positions et les couleurs.

In fact, I’m a huge proponent of designing your code around the data, rather than the other way around…Bad programmers worry about the code. Good programmers worry about data structures and their relationships.
— Linus Torvalds

UBO

Transformation de la texture avec un effet de rotation en quatre partie sur image

Floutage récursif  d'une image avec calcul sur Shaders

WebGL1 to WebGL2

By Johnny Da Costa

WebGL1 to WebGL2

  • 260