In the Orange Book, gl_position=MVPMatrix*MCVertex,however, in some GLSL courses, gl_position=ftransform(),i did not find ftransform() in the OpenGL Quick Reference Guide and also did not found variables such as gl_FrontMaterial,but it works in RenderMonkey, can some one tell me where i can get the major difference between different GLSL version?
It is because ftransform is deprecated since GLSL 1.3 I guess
Rendermonkey probably use a compatibility context.
In newer versions of GLSL you need to set up the matrices you want to use inside shader code.
Take a look at glsl 4.1 spec. There is a section called changes.
so you mean that i have to use functions such as glVertexAtrib() and glBindAttribLocation() to give value to MVMatrix instead of using gl_ModelViewMatrix directly?
Yes, if you are using a core context of version 3.1 or later.
You set the uniform MVPMatrix value with “glGetUniformLocation and glUniformMatrix4fv”. The attribute MCVertex is set using “glVertexAtrib() and glBindAttribLocation()”
After you compile your vertex shader, then you have to first get
//Get handle to shader uniform GLint h_MVPMatrix = glGetUniformLocation(program,"MVPMatrix");
then you need to set the MVPMatrix in the vertex shader
where your_matrix has 16 elements and controlled by you (instead of glTranslate/glRotate, etc) … the form of the matrix is described in the Section. OpenGL Transformation Matrix.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.