Default "camera" position when starting application

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Default "camera" position when starting application

Hello, I have probably very basic question and I am not fully sure where does it belong, but since I am learning using JOGL I will ask it here. Basically I have triangle rendered on the screen using very basic example:
gl2.glColor3f(1.0f, 0.0f, 0.0f);
gl2.glVertex3f(-0.5f, -0.5f,  0.0f);
gl2.glVertex3f( 0.5f, -0.5f,  0.0f);
gl2.glVertex3f(-0.5f,  0.5f,  0.0f);

It is displaying correctly as I expect the red triangle. Now if I add another one at exactly the same position, but with z = -0.5f for each vertex (with green color for example). I see green colored triangle displayed over the red one. I would like to understand why? The coordinate system suggest that the negative Z should be placing objects further in the space, but it looks like it is not true.

I am not applying any projection, the diplay() method is composed soloely by the two triangles and the:

In init() method I do enable the depth test.

So why in this case I see the green triangle over the red one and not the other way around (which seems more logical according to the coordinate system explanations I have read in multiple sites)?
Reply | Threaded
Open this post in threaded view

Re: Default "camera" position when starting application


I advise you to read this tutorial, especially the parts about the model, view and projection matrices:
Julien Gouesse | Personal blog | Website