Hello
Quelqu'un sait comment passer un attribut de type mat3 à un vertex shader?
J'arrive à passer des vecteurs mais j'aimerais passer une mat3.
Je précise que je parle bien d'attribut et non d'uniform.
Hello
Quelqu'un sait comment passer un attribut de type mat3 à un vertex shader?
J'arrive à passer des vecteurs mais j'aimerais passer une mat3.
Je précise que je parle bien d'attribut et non d'uniform.
Bonjour,
Dans la spécification, je vois ces belles fonctions :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 void uniform3f(WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z); void uniform3fv(WebGLUniformLocation location, Float32Array v); void uniform3fv(WebGLUniformLocation location, float[] v); void uniform3i(WebGLUniformLocation location, GLint x, GLint y, GLint z); void uniform3iv(WebGLUniformLocation location, Int32Array v); void uniform3iv(WebGLUniformLocation location, long[] v);
Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi
Ma page sur DVP
Mon Portfolio
Qui connaît l'erreur, connaît la solution.
Je re-précise que je parle bien d'attribut et non d'uniform.
Et non pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 attribute mat3 aMat3;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 uniform mat3 uMat3; varying mat3 vMat3;
Pardon. Dans la même spécification :
Dans la spécification du WebGL il réfère à la spécification de OpenGL ES 2 (section 2.7) qui dit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 void vertexAttrib1f(GLuint indx, GLfloat x); void vertexAttrib1fv(GLuint indx, Float32Array values); void vertexAttrib1fv(GLuint indx, float[] values); void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); void vertexAttrib2fv(GLuint indx, Float32Array values); void vertexAttrib2fv(GLuint indx, float[] values); void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); void vertexAttrib3fv(GLuint indx, Float32Array values); void vertexAttrib3fv(GLuint indx, float[] values); void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void vertexAttrib4fv(GLuint indx, Float32Array values); void vertexAttrib4fv(GLuint indx, float[] values); void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
La commande peut donc aussi être utilisée pour une matrice.The VertexAttrib* commands can also be used to load attributes declared as a
2×2, 3×3 or 4×4 matrix in a vertex shader. Each column of a matrix takes up one
generic 4-component attribute slot out of the MAX_VERTEX_ATTRIBS available
slots. Matrices are loaded into these slots in column major order. Matrix columns
need to be loaded in increasing slot numbers.
Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi
Ma page sur DVP
Mon Portfolio
Qui connaît l'erreur, connaît la solution.
Je pige pas trop, il me faudrait un exemple.
Est-ce que vous arriver à en trouver un ?
Il faut chercher du coté des demos WebGL, je pense.
Sinon, un programme OpenGL classique est similaire.
Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi
Ma page sur DVP
Mon Portfolio
Qui connaît l'erreur, connaît la solution.
Partager