/* * Copyright (c) 1996-1999 Silicon Graphics, Inc. All rights reserved. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* window.c - open a window in a specified position */ #include #include /* Segue il prototipo della funzione di rendering che verrą registrata con la callback glutDisplayFunc() */ GLvoid drawScene( GLvoid ); /* Seguono le variabili globali */ /* Le seguenti andranno a contenere le dimensioni dello schermo */ GLsizei width, height; /* Il seguente contatore serve per mostrare quando la funzione di renderign viene evocata. Esso viene inizializzato a 1 e, ad ogni chiamata, viene visualizzato e poi incrementato. Si noti come al variare dell'aspetto a video della finestra (si provi per esempio a occluderla parzialmente) il contatore aumenti. */ GLint count = 1; void main( int argc, char *argv[] ) { /* Inizializziamo le GLUT */ glutInit( &argc, argv ); /* Mostriamo sulla shell la dimensione in pixel del monitor */ width = glutGet( GLUT_SCREEN_WIDTH ); height = glutGet( GLUT_SCREEN_HEIGHT ); printf("dimensioni schermo: %d %d \n",width,height); /* create a window that is 1/4 the size of the screen, * and position it in the middle of the screen. */ glutInitWindowPosition( width / 4, height / 4 ); glutInitWindowSize( width / 2, height / 2 ); glutInitDisplayMode(GLUT_DOUBLE|GLUT_STENCIL|GLUT_DEPTH|GLUT_ALPHA); glutInitDisplayMode( GLUT_RGBA ); glutCreateWindow( argv[0] ); /* Registriamo la funzione di rendering */ glutDisplayFunc( drawScene ); /* Abbia inizio il loop principale dell'applicazione */ glutMainLoop(); } GLvoid drawScene( GLvoid ) { /* You will do all of your OpenGL rendering here */ printf("Chiamata numero: %d \n", count); count++; }