Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How does glutReshapeFunc work?

  1. #1
    Newbie Newbie
    Join Date
    May 2013

    How does glutReshapeFunc work?

    I found this piece of code:

    Code :
    void reshape (int w, int h) {
    glViewport (0, 0, (GLsizei)w, (GLsizei)h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    gluPerspective (60, (GLfloat)w / (GLfloat)h, 0.1, 100.0);
    glMatrixMode (GL_MODELVIEW);
    int main (int argc, char **argv) {
    glutInit (&argc, argv);
    glutInitDisplayMode (GLUT_DOUBLE);
    glutInitWindowSize (640, 480);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Ellipses");
    glutDisplayFunc (display);
    glutIdleFunc (display);
    glutReshapeFunc (reshape);
    glutMainLoop ();
    return 0;
    how does the call to reshape work, what are the values of w and h in this case ???
    Last edited by Monique; 05-07-2013 at 01:21 PM.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    See documentation for glutReshapeFunc. Like all the glut*Func() functions this registers a callback function, a function that is called in response to a window system/OS event, so that your application has a chance to handle it appropriately.

    Please use [ code]/[ /code] (without space after '[') around source code snippets, see also Forum Posting Guidelines, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts