| 876 | |
| 877 | == vaja129 == |
| 878 | V eneom od prejšnih vajah uporabite naslednji podprogram in ga prijavi kot GLUT podprogram, |
| 879 | ki se izvede pri spremembi velikosti okna. |
| 880 | |
| 881 | {{{ |
| 882 | #!c |
| 883 | void reshape(int w, int h) |
| 884 | { |
| 885 | GLdouble width = w, height = h; |
| 886 | GLdouble left, right, bottom, top, znear, zfar; |
| 887 | |
| 888 | if (w > h) |
| 889 | { |
| 890 | left = -width/height; |
| 891 | right = width/height; |
| 892 | bottom = -1.0; |
| 893 | top = 1.0; |
| 894 | } |
| 895 | else |
| 896 | { |
| 897 | left = -1.0; |
| 898 | right = 1.0; |
| 899 | bottom = -height/width; |
| 900 | top = height/width; |
| 901 | } |
| 902 | znear = -1.0; |
| 903 | zfar = 1.0; |
| 904 | glViewport(0, 0, w, h); |
| 905 | glMatrixMode(GL_PROJECTION); |
| 906 | glLoadIdentity(); |
| 907 | glOrtho(left, right, bottom, top, znear, zfar); |
| 908 | glMatrixMode(GL_MODELVIEW); |
| 909 | glLoadIdentity(); |
| 910 | } |
| 911 | }}} |
| 912 | Kakšna je lastnost take spremembe okna? Začetno okno izrišite v velikosti 500x300. |
| 913 | |