Bonjour a tous,
Merci pour ce tutoriel clair et concis, je rencontre un problème de compatibilité glsl, du coup l'exemple des shaders et du render offscreen ne sont pas fonctionnels. Quelqu'un aurait il une idée de ce que je doit changer pour les faire fonctionner sous glsl 1.2, je suis sous osx 10.8.5 et a priori je n'aurais pas sur cette machine une version glsl > 1.20, je cherche donc un moyen d'adapter la source.

so far j'ai modifié:

Code glsl : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
#version 120
varying float color_factor;
varying vec4 texture_color;
float ratio_shadow = 0.2;
float ratio_texture = 0.6;
uniform vec4 ambiant_color;
const vec4 blanc = vec4(1.0, 1.0, 1.0, 1.0);
void main(){
 
    gl_FragColor = ambiant_color
                   + (blanc * ratio_shadow * color_factor)
                   + (blanc * ratio_texture * texture_color);
}

Code glsl : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#version 120
varying vec4 vertex;
varying vec4 normal;
varying vec2 texture_coordonnees;
varying float color_factor;
varying vec4 texture_color;
uniform mat4 matrixpmv;
uniform vec4 light_direction;
uniform sampler2D texture2d;
void main()
{
    color_factor  = max(dot(normal, light_direction), 0.0);
    texture_color = texture2D(texture2d, texture_coordonnees.st);
    gl_Position   = matrixpmv * vertex;
}

avec et sans varying, same result,.
J'ai aussi ajouté ajouté glEnable(GL_TEXTURE_2D); ligne 181. au cas ou...
Sans résultat, aucun affichage dans la view.
Toute suggestion sera la bienvenue.
MErci