excuse me for this silly question. i have just started learnling openGL.
at first, i defined the following funciton:
void myTriangle(void) {
glBegin(GL_LINE_LOOP);
glVertex2f(0,50);
glVertex2f(50,-50);
glVertex2f(-50,-50);
glEnd();
return;
}
in the function display, i drawed a red triangle, using void myTriangle(void):
void CALLBACK display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
myTriangle();
// gluLookAt(0,0,0, 0,0,-100, 0,100,0);
// gluLookAt(0,0,0, 0,0,-100, 100,0,0);
glFlush();
return;
}
since the coordinate of the bottom-left point of screen is(0,0),
i can see only a part of my red triangle.
then, i tried to change the position of my eyes by using the function gluLookAt.
after the first // is the default setting of my eyes.
i tried to rotate my head to the right( 90 degree ) by deleting the second //.
it does not work.
i dont know why,if you know, please tell me.thanks a lot.
below is the whole program, i have compiled run it successfully in VC6,windows2K.
================all the source codes==============
include <windows.h>
include <GL/gl.h>
include <GL/glu.h>
include <GL/glaux.h>
void myTriangle(void) {
glBegin(GL_LINE_LOOP);
glVertex2f(0,50);
glVertex2f(50,-50);
glVertex2f(-50,-50);
glEnd();
return;
}
void myinit(void) {
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
return;
}
void CALLBACK display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
myTriangle();
gluLookAt(0,0,0, 0,0,-100, 100,0,0);
glFlush();
return;
}
int main(int argc,char ** argv) {
auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
auxInitPosition(0,0,200,200);
auxInitWindow(“hello world”);
myinit();
auxMainLoop(display);
return 0;
}