Dear Forum…
before post my code composed by 2 very basic shader, i ask some basic question
about matrix manipulation and then about passign data to a vertex,that are not again
so clear to me, and maybe are the responsible of this error.
So, first question are:
1)About projection matrix. This code:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glfrustum(......);
is setting projection matrix P =I (so clear it) and then, the glfrustum() set the P matrix
derived from parameter of glfrustum. In particular, it multiply the Previous P for the new
P,so,P continue to change every time glfrustum is called…this is because we need to
reset every time with I.
The frustum also decide the clipping…
Is all correct ?
2)If previos is correct then:
a) if i want a perspective projection i use the previous code for set P.
b) if i want a ortho projection ,then i use
glMatrixMode(GL_PROJECTION);
glLoadIdentity()
glOrtho(......................);
The glortho is not modifing P (that is P=I), but is ONLY setting the clipping space.
Correct ?
3)Why in all code i see ,we must set the P ,the MV matrix and Viewport in the changesize()
event ?
The window dimension is some related to vieport,and,if i let it fix, and , if i dont change P
,why we need every time to reset to I and set?
Maybe is only necessary to reset the MV matrix in the render() roudine, if we use a translation,
rotation ecc…But is not so.Why??
For now i want be sure about this, and then post the new questions.
Thanks again
Roberto