Hello. I have quite strange problem.
while( running )
{
glfwGetMousePos( &x, &y );
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 75.0f, (GLfloat)640/(GLfloat)480, 1.0f, 300.0f );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt(0,-10,10,0,0,10+vdirection,0,1,0);
glPushMatrix();
glPopMatrix();
glBindTexture(GL_TEXTURE_2D,texture);
glTranslatef(0,0,5);
glScalef(5,5,5);
model2.draw();
angle+=1;
if (angle>360) angle-=360;
glfwSwapBuffers();
if(glfwGetKey( GLFW_KEY_LEFT )) {
direction-=1;
};
if(glfwGetKey( GLFW_KEY_RIGHT )) {
direction+=1;
};
if(glfwGetKey( GLFW_KEY_UP )) {
if (vdirection<89) vdirection+=1;
};
if(glfwGetKey( GLFW_KEY_DOWN )) {
if (vdirection>-89) vdirection-=1;
};
running = !glfwGetKey( GLFW_KEY_ESC ) &&
glfwGetWindowParam( GLFW_OPENED );
}
glfwTerminate();
exit( EXIT_SUCCESS );
};
There is a lot of garbage but this is just for experimenting. Now the problem is next:
When xfrom and xto in gluLookAt are equal it doesn’t shows anything at all, only a black screen. If xto is larger than xfrom then it just shows everything upside-down! What is going on?