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

Langage Delphi Discussion :

[Delphi / DeviL / OpenGL] Problème Texture...


Sujet :

Langage Delphi

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 11
    Points : 8
    Points
    8
    Par défaut [Delphi / DeviL / OpenGL] Problème Texture...
    Bonjour A tous !
    J'ai un problème halucinant (pour moi... pour certain sa sera une partie de plaisir)

    J'essaye depuis 2 jours d'affiché une texture sur le coté du cube je me suis donc orienté vers le portage de devil sous delphi.
    Et pas moyen d'affiché ma ***** de texture...

    Je post mon code il semble être simple a comprendre et parle de lui même.
    Deplus Delphi me dit que ILinit() n'est pas déclaré pourtant ça compile et le programme se lance (et quand je fait cherché la declaration il l'a trouve sans problême).

    Edit : Je complête par le fait que IlutGlLoadImage me revois tous le temps 0
    (Pourtant ma texture existe et fileExists me renvoie true...)(Encore une nuit de passez dessus :'( )

    Merci d'avance vos reponses me feront plus de bien que toute les clops et les cafés que j'ai bu pour tenir dans mes longues heures de lectures... Et de tentavie infructueuse...

    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
    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
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    program Project2;
     
    {$APPTYPE CONSOLE}
     
    uses
      SysUtils,
      opengl,
      openilu in '..\projet\openilu.pas',
      glfw in '..\projet\glfw.pas',
      openil in '..\projet\openil.pas',
      openilut in '..\projet\openilut.pas',
      GL in '..\projet\GL.pas';
     
    var
      image : GLuint;
     
    {Initialisation de DevIl Et loadage de la texture en mémoire(ou pas)}
    procedure InitIl();
    begin
         ilinit();
         Ilutinit();
         Iluinit();
         ilutEnable(ILUT_OPENGL_CONV);
         ilutRenderer(IL_OPENGL);
         // Fin de l'initialisation pure
     
          {Chargement des textures en Mémoires}
        if FileExists('texture/sanstitre2.jpg') then
     
         image := ilutGLLoadImage ('texture/sanstitre2.jpg')
     
        else
          GLFWTerminate();
     
    end;
     
    procedure Draw();
    var
         width, height : integer;
         t : double;
    Begin
          t := glfwGetTime();
          glfwGetWindowSize( width, height );
          if height < 1 then
            height := 1;
          glViewport( 0, 0, width, height );
          glClearColor( 0.0, 0.0, 0.0, 0.0 );
          glClear( GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT );
          glMatrixMode( GL_PROJECTION );    // Select projection matrix
          glLoadIdentity();                 // Start with an identity matrix
          gluPerspective(                   // Set perspective view
              65,                // Field of view
              width/height, // Window aspect (assumes square pixels)
              1.0,                          // Near Z clipping plane
              100.0                         // Far Z clippling plane
          );
          glMatrixMode( GL_PROJECTION );
          gluLookAt(                        // Set camera position and orientation
              5, 5, 10, // Camera position (x,y,z)
              0.0, 1.0, 0.0,                // View point (x,y,z)
              0.0, 1.0, 0.0);
     
        {----------Ici on commence a codé------------}
     
        glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, image);
     
      glBegin(GL_QUADS);
        glTexCoord2i(1,0);glVertex3f(-1,-1,1);
        glTexCoord2i(0,0);glVertex3f(1,-1,1);
        glTexCoord2i(0,1);glVertex3f(1,1,1);
        glTexCoord2i(1,1);glVertex3f(-1,1,1);
     
        glColor3f(0,1,0); glVertex3f(1,1,-1);
        glColor3f(0,0,1); glVertex3f(-1,1,-1);
        glColor3f(1,0,0); glVertex3f(-1,1,1);
        glColor3f(1,0,0); glVertex3f(1,1,1);
     
        glColor3f(0,0,1); glVertex3f(-1,-1,-1);
        glColor3f(0,1,0); glVertex3f(1,-1,-1);
        glColor3f(1,0,0); glVertex3f(1,1,-1);
        glColor3f(1,0,0); glVertex3f(-1,1,-1);
     
        glColor3f(0,1,0); glVertex3f(1,-1,-1);
        glColor3f(0,0,1); glVertex3f(1,-1,1);
        glColor3f(1,0,0); glVertex3f(1,1,1);
        glColor3f(1,0,0); glVertex3f(1,1,-1);
     
        glColor3f(0,0,1); glVertex3f(-1,-1,-1);
        glColor3f(0,1,0); glVertex3f(-1,-1,1);
        glColor3f(1,0,0); glVertex3f(-1,1,1);
        glColor3f(1,0,0); glVertex3f(-1,1,-1);
     
        glColor3f(0,1,0); glVertex3f(1,-1,-1);
        glColor3f(0,0,1); glVertex3f(-1,-1,-1);
        glColor3f(0,1,0); glVertex3f(-1,-1,1);
        glColor3f(0,0,1); glVertex3f(1,-1,1);
      glEnd();
     
      glEnable(GL_BLEND);
    glPopMatrix();
      glDisable(GL_TEXTURE_2D);
    End;
     
    procedure InitGLFW();
    begin
           glfwInit(); {Initialisation GLFW}
           glfwOpenWindow(
              1024, 768,          // Width and height of window
              8, 8, 8,           // Number of red, green, and blue bits for color buffer
              8,                 // Number of bits for alpha buffer
              24,                // Number of bits for depth buffer (Z-buffer)
              0,                 // Number of bits for stencil buffer
              GLFW_WINDOW{GLFW_FULLSCREEN}
            );
          glfwSetWindowTitle( '.Sluged''' );
          glEnable( GL_DEPTH_TEST );
          glDepthFunc( GL_LEQUAL );
    end;
     
    procedure MainLoop();
    begin
      repeat
        Draw();
        glfwSwapBuffers();
      until((glfwGetKey(GLFW_KEY_ESC)) and glfwGetWindowParam(GLFW_OPENED)=1);
      glfwTerminate();
    end;
     
    begin
      InitGLFW;
      InitIl;
      MainLoop;
    end.

  2. #2
    Expert éminent sénior
    Avatar de Paul TOTH
    Homme Profil pro
    Freelance
    Inscrit en
    Novembre 2002
    Messages
    8 964
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Freelance
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2002
    Messages : 8 964
    Points : 28 448
    Points
    28 448
    Par défaut
    je ne connais pas Devil, mais à vu de nez tes coordonnées de textures ne sont pas bonnes...prend la version glTextCoord2f...j'ai un doute sur les valeurs en 2i...

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 11
    Points : 8
    Points
    8
    Par défaut
    J'ai modifié mon code mais je pense avoir cerné le probleme..
    Ma Fonction ilutGLLoadImage renvoi 0 en permanence.. peut importe le format la taille (j'ai teste avec différents format et différente dimension)..
    Je m'arache les cheveux.. smatin en m'endormant j'ai même révé d'openGL. Jdevien fou aidez moi ! xD

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2008
    Messages : 42
    Points : 51
    Points
    51
    Par défaut
    Je connais pas Devil non plus,

    mais goggle > projet DEvil > sourceforge > Browse CVS :
    me voilà devant le source de la bibliothèque de ILUTGL..

    source où l'on remarque :

    // Absolutely *have* to call this if planning on using the image library with OpenGL.
    //Call this after OpenGL has initialized.
    ILboolean ilutGLInit()

    Bref a mon avis (pas testé) il suffit peut être de mettre ilutGLInit() au début avec les autres inits pour que ca marche.

Discussions similaires

  1. Réponses: 10
    Dernier message: 08/06/2009, 11h30
  2. [libjpeg && opengl] problème "multi-texturing"
    Par pspflashsystem dans le forum OpenGL
    Réponses: 4
    Dernier message: 23/02/2009, 13h01
  3. Réponses: 15
    Dernier message: 29/03/2008, 15h08
  4. OpenGL: problème pour incorporer des textures
    Par milena dans le forum OpenGL
    Réponses: 5
    Dernier message: 23/03/2008, 17h16
  5. [DevIL] Aide DevIL pour chargement texture Opengl
    Par CPPTryer dans le forum DevIL
    Réponses: 1
    Dernier message: 10/02/2006, 16h47

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