Original Post
Hello All. I am a newbie to GLSL. I intend to rotate a triangle by some degrees using GLSL. I created a triangle using glBegin(GL_TRIANGLES).using glShadeModel(GL_FLAT) with blue color. Now in the vertex shader I am doing following: -------------------------------------------------------------------------- //This is vertex shader that rotates the triangle by 180 deg. void main(void) { vec4 vf_new_position; //local variable. float fAngle = 0.0; fAngle = radians(180.0); vf_new_position = vec4(gl_Vertex); //z coordinate remains unchanged.i.e rotation is around z axis. vf_new_position.x = cos( fAngle )*(gl_Vertex.x/gl_Vertex[3]) - sin( fAngle )*(gl_Vertex.y/gl_Vertex[3]) ; vf_new_position.y = sin( fAngle )*(gl_Vertex.x/gl_Vertex[3]) + cos( fAngle )*(gl_Vertex.y/gl_Vertex[3]) ; vf_new_position.z = (gl_Vertex.z/gl_Vertex[3]) ; vf_new_position.w = gl_Vertex; gl_Position = gl_ModelViewMatrix * vf_new_position; } -------------------------------------------------------------------------- After compiling and executing, I am getting a blank screen. Note: I checked the shader and program log file --- no errors. What can be the real problem? Why can 't I see triangle rotated? Help appreciated.