IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenGL Discussion :

[OpenGL]Compilation avec GLUT


Sujet :

OpenGL

  1. #1
    Membre confirmé Avatar de saad.hessane
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2008
    Messages
    315
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 315
    Points : 496
    Points
    496
    Par défaut [OpenGL]Compilation avec GLUT
    Bonjour tout le monde.
    Après avoir lu les cours de NeHe sur OpenGL avec l'API WIN32, j'ai commencé à lire le livre "OpenGL programming guide - the red book". Le livre utilise GLUT. Je n'arrive pas à compiler avec Visual Studio 2008 le code suivant :
    Code C++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    /*
     * Copyright (c) 1993-2003, Silicon Graphics, Inc.
     * All Rights Reserved
     *
     * Permission to use, copy, modify, and distribute this software for any
     * purpose and without fee is hereby granted, provided that the above
     * copyright notice appear in all copies and that both the copyright
     * notice and this permission notice appear in supporting documentation,
     * and that the name of Silicon Graphics, Inc. not be used in
     * advertising or publicity pertaining to distribution of the software
     * without specific, written prior permission.
     *
     * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "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, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
     * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
     * OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, LOSS OF
     * PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD
     * PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN ADVISED OF
     * THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF
     * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE
     * OR PERFORMANCE OF THIS SOFTWARE.
     *
     * US Government Users Restricted Rights 
     * Use, duplication, or disclosure by the Government is subject to
     * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
     * (c)(1)(ii) of the Rights in Technical Data and Computer Software
     * clause at DFARS 252.227-7013 and/or in similar or successor clauses
     * in the FAR or the DOD or NASA FAR Supplement.  Unpublished - rights
     * reserved under the copyright laws of the United States.
     *
     * Contractor/manufacturer is:
     *	Silicon Graphics, Inc.
     *	1500 Crittenden Lane
     *	Mountain View, CA  94043
     *	United State of America
     *
     * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
     */
     
    /*
     * hello.c
     * This is a simple, introductory OpenGL program.
     */
    #include <GL/glut.h>
    #include <stdlib.h>
     
    void display(void)
    {
    /* clear all pixels  */
       glClear (GL_COLOR_BUFFER_BIT);
     
    /* draw white polygon (rectangle) with corners at
     * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)  
     */
       glColor3f (1.0, 1.0, 1.0);
       glBegin(GL_POLYGON);
          glVertex3f (0.25, 0.25, 0.0);
          glVertex3f (0.75, 0.25, 0.0);
          glVertex3f (0.75, 0.75, 0.0);
          glVertex3f (0.25, 0.75, 0.0);
       glEnd();
     
    /* don't wait!  
     * start processing buffered OpenGL routines 
     */
       glFlush ();
    }
     
    void init (void) 
    {
    /* select clearing color 	*/
       glClearColor (0.0, 0.0, 0.0, 0.0);
     
    /* initialize viewing values  */
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
    }
     
    /* 
     * Declare initial window size, position, and display mode
     * (single buffer and RGBA).  Open window with "hello"
     * in its title bar.  Call initialization routines.
     * Register callback function to display graphics.
     * Enter main loop and process events.
     */
    int main(int argc, char** argv)
    {
       glutInit(&argc, argv);
       glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
       glutInitWindowSize (250, 250); 
       glutInitWindowPosition (100, 100);
       glutCreateWindow ("hello");
       init ();
       glutDisplayFunc(display); 
       glutMainLoop();
       return 0;   /* ANSI C requires main to return int. */
    }
    L'erreur que j'ai à la compilation :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit'*: redéfinition*; __declspec(noreturn) est différent
    Merci d'avance pour votre aide.

  2. #2
    Membre confirmé Avatar de saad.hessane
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2008
    Messages
    315
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 315
    Points : 496
    Points
    496
    Par défaut
    C'est bon, j'ai trouvé tout seul. Il faut créer un projet Console, et il faut inclure stdlib.h avant glut.h.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Impossible d'appliquer une texture avec Glut et Opengl
    Par akrogames dans le forum OpenGL
    Réponses: 5
    Dernier message: 29/10/2010, 10h20
  2. Réponses: 3
    Dernier message: 19/05/2009, 15h32
  3. Bien compiler avec qt4, OpenGL et lib3ds
    Par Robert Dumarais dans le forum OpenGL
    Réponses: 3
    Dernier message: 15/12/2008, 13h17
  4. Slider OpenGl (avec Glut)
    Par spnzero dans le forum OpenGL
    Réponses: 5
    Dernier message: 22/11/2008, 11h12
  5. Gros pb de débutant sous opengl avec glut
    Par mozillo3625 dans le forum Dev-C++
    Réponses: 2
    Dernier message: 06/12/2007, 14h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo