Hi!
I’m quite a beginner in the use of shaders. I wonder how the transformations are handled in a shader-based engine that does not rely on the fixed pipeline. For example, currently I do this to draw a model composed of several parts :
gl.glPushMatrix(GL.GL_MODELVIEW_MATRIX);
gl.glMultMatrix(transform0);
//draw the first part
gl.glPushMatrix(GL.GL_MODELVIEW_MATRIX);
gl.glMultMatrix(transform1);
//draw the second part
gl.glPopMatrix();
gl.glMultMatrix(transform2);
//draw the third part
gl.glMultMatrix(transform3);
//draw the fourth part
gl.glPopMatrix();
gl.glPopMatrix();
gl.glPopMatrix();
In a GLSL vertex shader, I assume I can use a mat4 as an uniform variable to contain a transformation matrix but I cannot use one uniform variable per transform and use it with a single vertex shader. Should I use several shaders? Is my approach completely wrong? How do you use vertex shaders to draw the content of a scene graph?