Viewing Problems

Having spent many hours trying to debug this, I am still lost for an answer.
I am drawing spheres and texturing them which works fine but my viewing settings are wierd. After drawing the model, I am setting the matrixmode to projection, loading the identity matrix and then using glperspective to create a view. My problem here is that, firstly, no matter where my eye position is set to, it always shows the same image as if it hasn’t been changed. Secondly, depending on my fovy, it changes the view, but distorts the spheres and the textures become elongated in the z axis.
I should add that I am using the JOGL interface in Java for calling the OpenGL commands however all that’s different for the commands I’m using is the syntax. I can post code if it helps.

I am guessing from the information you provided that the perspective settings might be not what you desire.

Try using a width/height of the window in the 2nd parameter and see if something changes, like that:

glMatrixMode(GL_MODELVIEW); // Not GL_PERSPECTIVE ! //
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

There is also a thread about a similar problem, which you might want to check:

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=81159

Is there a reason why you set your projection matrix after drawing? It’s normally done before.

glMatrixMode(GL_MODELVIEW); // Not GL_PERSPECTIVE ! //
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

thats incorrect

it should be
glMatrixMode(GL_PERSPECTIVE);
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
position viewer

the OP needs to post a bit some code of what theyre doing otherwise we’ll just be guessing what the cause is

I’ve managed to fix it now. I eventually found it to be a problem with the texture coordinates not being generated correctly. I switched on mipmapping and it fixed the problem with textures and I’ve fixed the problems with the projection.