Code below shows how to rotate model with quaternion

vec3 qtransform( vec4 q, vec3 v ){ 
	return v + 2.0*cross(cross(v, q.xyz ) + q.w*v, q.xyz);
	}
void main()
{
	gl_FrontColor = gl_Color;
	gl_TexCoord[0] = gl_MultiTexCoord0;
	//gl_Position = ftransform();
     vec4 q = vec4(0,0,1,1);
     vec3 v = gl_Vertex.xyz;
     vec4 r = vec4(qtransform(q,v),gl_Vertex.w);
     gl_Position =gl_ProjectionMatrix * gl_ModelViewMatrix *r;
    
}


Last edited Aug 21, 2013 at 2:46 AM by younthu, version 1

Comments

No comments yet.