PDA

View Full Version : My cube is not a cube ?



DeXtr0
09-06-2004, 09:40 AM
Hey Guys,

I got something weird going on.
I defined 4 viewports for each corner of the window in where i defined a rotating cube (which i scaled by glscale).

The strange thing is that the cubes don't look really like a cube but more like a cube/rectangle.. It seems my vertexes are not good defined but I can't find the error.

Besides that, if the cube rotates, I notice a distortion on the corners of the cube.

Is there anybody who can give a hand to this rookie starter ?

Code can be found here:
http://thepartybrothers.webtrip.ch/temp/intro/SiteTro.rar

Thanks a lot,
DeXtr0

-NiCo-
09-06-2004, 02:31 PM
There is nothing wrong with your code.
If you remove either the rotation about the x axis or the y axis of the cubes, you will see that the outlines of the cube remain strictly rectangular, but the texturing gives you the 'impression' that it is being stretched somehow.

The reason for this, is that the human eye is not used to seeing orthographic projections.

Try inserting


glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-0.1f,0.1f,-0.1f,0.1f,0.4f,100.0f);
glTranslatef(0.0,0.0,-5.);at the top of the DrawGLSceneCubes function.

Another hint:
Set the filter value to 2 and change the minification filter from GL_LINEAR_MIPMAP_NEAREST to GL_LINEAR_MIPMAP_LINEAR, the transitions between the mipmap levels will be smoother.

Greetz,

Nico

DeXtr0
09-07-2004, 09:05 AM
Hey Nico,

the tip you gave me is awesome..

Thnx mate, really appreciated.

Regards,
DeXtr0