Changes between Version 55 and Version 56 of naloge


Ignore:
Timestamp:
Nov 28, 2008, 8:07:58 PM (15 years ago)
Author:
Leon Kos
Comment:

129

Legend:

Unmodified
Added
Removed
Modified
  • naloge

    v55 v56  
    874874}}}
    875875
     876
     877== vaja129 ==
     878V eneom od prejšnih vajah uporabite naslednji podprogram in ga prijavi kot GLUT podprogram,
     879ki se izvede pri spremembi velikosti okna.
     880
     881{{{
     882#!c
     883void 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}}}
     912Kakšna je lastnost take spremembe okna? Začetno okno izrišite v velikosti 500x300.
     913