Hello Everyone,
I am new to OpenGL and Cg. I am trying to draw a triangle strip on the
screen. The vertex program just gets the position, changes the color
of the triangle and renders it on the screen. It comes fine, except
that I am unable to change the position of the camera(viewpoint). The
gluLookAt() function doesn't seem to work. Can anyone please tell me
what am I missing. Here's the code:
void Draw (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
gluLookAt(0.0f, 0.0f, -200.0f, 0.0f, 0.0f, 0.0f, 0, 1, 0);
cgGLEnableProfile(cgVertexProfile);
cgGLBindProgram(cgProgram);
//gluLookAt(0.0f, 0.0f, -200.0f, 0.0f, 0.0f, 0.0f, 0, 1, 0);
// I tried inserting it in between the Cg enable and disable
profiles
glColor3f(0.0f,0.0f,1.0f);
glBegin(GL_TRIANGLE_STRIP);
glVertex2f(0.1,0.0);
glVertex2f(0.3,0.5);
glVertex2f(0.5,0.0);
glVertex2f(0.7,0.5);
glEnd();
cgGLDisableProfile(cgVertexProfile);
glFlush ();
}
Thank you,
Sriram
|