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 :

Texture avec jpeglib


Sujet :

OpenGL

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Doctorante
    Inscrit en
    Avril 2009
    Messages
    56
    Détails du profil
    Informations professionnelles :
    Activité : Doctorante

    Informations forums :
    Inscription : Avril 2009
    Messages : 56
    Par défaut Texture avec jpeglib
    Bonsoir;

    j'ai developpé une application en visual c++ 2008 qui permet de dessiner une scène 3D à partir d'un fichier obj, je veux texturer les objets de la scène,
    pour cela j'ai fait appel à la bibliothèque jpeglib pour charger l'image de texture.

    j'ai trouvé des erreurs de link incompréhensible dans cette fonction:

    Code : 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
    gl_texture_t *
    ReadJPEGFrom(const file_buffer_t *file)
    {
      gl_texture_t *texinfo = NULL;
      struct jpeg_decompress_struct cinfo;
      struct my_error_mgr jerr;
      struct jpeg_source_mgr jsrc;
      JSAMPROW j;
      int i;
     
       //create and configure decompress object 
      jpeg_create_decompress (&cinfo);
      cinfo.err = jpeg_std_error (&jerr.pub);
      cinfo.src = &jsrc;
     
      //configure error manager 
      jerr.pub.error_exit = err_exit;
     
      if (setjmp (jerr.setjmp_buffer))
        {
          jpeg_destroy_decompress (&cinfo);
     
          if (texinfo)
    	{
    	  if (texinfo->texels)
    	    free (texinfo->texels);
     
    	  free (texinfo);
    	}
     
          return NULL;
        }
     
       //configure source manager 
      jsrc.next_input_byte = file->data;
      jsrc.bytes_in_buffer = file->length;
      jsrc.init_source = mem_init_source;
      jsrc.fill_input_buffer = mem_fill_input_buffer;
      jsrc.skip_input_data = mem_skip_input_data;
      jsrc.resync_to_restart = jpeg_resync_to_restart;
      jsrc.term_source = mem_term_source;
     
      //read file's header and prepare for decompression 
      jpeg_read_header (&cinfo, TRUE);
      jpeg_start_decompress (&cinfo);
     
      texinfo = (gl_texture_t *)malloc (sizeof (gl_texture_t));
      texinfo->width = cinfo.image_width;
      texinfo->height = cinfo.image_height;
      texinfo->internalFormat = cinfo.num_components;
      texinfo->format = (cinfo.num_components == 1) ? GL_LUMINANCE : GL_RGB;
     
      texinfo->texels = (GLubyte *)malloc (sizeof (GLubyte) * texinfo->width
    			       * texinfo->height * texinfo->internalFormat);
     
     
      for (i = 0; i < texinfo->height; ++i)
        {
    #if 1
          j = (texinfo->texels + ((texinfo->height -
    	(i + 1)) * texinfo->width * texinfo->internalFormat));
    #else
          j = &texinfo->texels[texinfo->width * i * texinfo->internalFormat];
    #endif
     
          jpeg_read_scanlines (&cinfo, &j, 1);
        }
     
     
      jpeg_finish_decompress (&cinfo);
      jpeg_destroy_decompress (&cinfo);
     
      return texinfo;
    }
    les erreurs sont:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_finish_decompress referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_read_scanlines referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_start_decompress referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_read_header referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_resync_to_restart referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_destroy_decompress referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_std_error referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    1>texture.obj : error LNK2019: unresolved external symbol _jpeg_CreateDecompress referenced in function "struct gl_texture_t * __cdecl ReadJPEGFrom(struct file_buffer_t const *)" (?ReadJPEGFrom@@YAPAUgl_texture_t@@PBUfile_buffer_t@@@Z)
    comment corrigé ces erreurs svp?

    merci d'avance.

  2. #2
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    27 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 27 150
    Billets dans le blog
    150
    Par défaut
    Bonjour,

    Il faut rajouter une mention à votre bibliothèque jpeg dans la configuration de l'éditeur de lien (Là, ou vous rajouter une mention "opengl32.lib" dans les propriétés du projet).
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  3. #3
    Membre confirmé
    Doctorante
    Inscrit en
    Avril 2009
    Messages
    56
    Détails du profil
    Informations professionnelles :
    Activité : Doctorante

    Informations forums :
    Inscription : Avril 2009
    Messages : 56
    Par défaut
    j'ai corrigé mes erreurs
    merci bcp

  4. #4
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    27 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 27 150
    Billets dans le blog
    150
    Par défaut
    Sujet résolu donc ?
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  5. #5
    Membre confirmé
    Doctorante
    Inscrit en
    Avril 2009
    Messages
    56
    Détails du profil
    Informations professionnelles :
    Activité : Doctorante

    Informations forums :
    Inscription : Avril 2009
    Messages : 56
    Par défaut
    Citation Envoyé par LittleWhite Voir le message
    Sujet résolu donc ?
    oui

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

Discussions similaires

  1. Textures avec transparence
    Par Corpio dans le forum OpenGL
    Réponses: 8
    Dernier message: 05/05/2006, 15h56
  2. Réponses: 10
    Dernier message: 13/04/2006, 15h54
  3. Réponses: 1
    Dernier message: 06/04/2006, 17h04
  4. chargement de texture avec la SDL
    Par Fry dans le forum OpenGL
    Réponses: 7
    Dernier message: 27/05/2004, 15h31
  5. Combiner plusieurs textures avec couches alpha
    Par TibobiT dans le forum OpenGL
    Réponses: 2
    Dernier message: 01/05/2004, 15h20

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