I'm beginner in OpenGL and I stumbled into a problem. I'm in OpenGL 2.1 for the time being, if that's of any help.
I set my Frustum as such:
glFrustum(-1366, 1366, -768, 768, 1, 20000);
Now, when I create a cube from quads like this:
0.0, 500.0, 0.0
500.0, 500.0, 0.0
500.0, 0.0, 0.0
0.0, 0.0, 0.0
0.0, 500.0, 500.0
500.0, 500.0, 500.0
500.0, 0.0, 500.0
etc.
It is not a cube, as I expected. It's extremely stretched along the z axis.
Here's a screenshot of how it looks now: https://www.dropbox.com/s/diznfumtev7g259/Screenshot%20from%202016-02-26%2017%3A01%3A58.png?dl=0 (I removed one of the faces temporarily)
The shape starts to resemble a cube a bit when I change the vertices to:
0.0, 500.0, 0.0
500.0, 500.0, 0.0
500.0, 0.0, 0.0
0.0, 0.0, 0.0
0.0, 500.0, 0.3
500.0, 500.0, 0.3
500.0, 0.0, 0.3
etc.
Code related to this (I am translating this from assembly which I am actually using).
Matrices setup on initialization:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1366.0, 1366.0, -768.0, 768.0, 1.0, 20000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Transformations of the cube inside the "render()" function:
glLoadIdentity();
glTranslated(1000.0, 500.0, 0.0);
glRotated(degrees, 0.0, 0.0, 1.0); // degrees is +=2 every frame
glTranslated(-250.0, -250.0, distance); // distance is -=0.001 every frame
There are no other matrix operations in the code.
The code uses GLUT to initialize a window with double buffer and depth buffer. Depth testing is enabled.
It all seems to work as expected, the rotation is ok, movement also. I am only troubled by the fact that when I define a 500.0x500.0x500.0 cube, the actual output is not a cube.
What am I doing wrong? How to fix this?