Je me suis lancé (pas trop loin quand même) dans le développement d'une petite application en OpenGL.

Je rencontre un problème pour l'application d'une texture sur un GL_QUADS
J'ai une image de 2048x32 pixels et je veux appliquer 1/32 em sur ce carré.

Cette image représente 64 Caractères de 32x32 pixels

Si j'utilise la texture tel quelle, j'ai des lignes de couleurs qui s'affichent à la place du caractères.
Si je réduit l'image en 256x32 par exemple, ca fonctionne normalement.

Y a t il une limitation dans la taille d'une texture ?

Ci dessous mon code (en Delphi)

Code Delphi : 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
 
var
  iSizeChar : GlFloat;
begin
  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);    
  glLoadIdentity();                                    
 
  glPushMatrix;
    glTranslate(PosX,PosY,Pronfondeur);
    glRotatef(AngleX,1,0,0);
    glRotatef(AngleY,0,1,0);
    glRotatef(AngleZ,0,0,1);
    glBindTexture(GL_TEXTURE_2D, FontTex);
    iSizeChar := 1 / 64; // 1 / 8 si j'utilise une image de 256 x 32
    glBegin(GL_QUADS);
      glTexCoord2f(iSizeChar * 2 ,0);        glVertex2f(-0.25,-0.25);
      glTexCoord2f(iSizeChar * 2 + iSizeChar,0);   glVertex2f(0.25,-0.25);
      glTexCoord2f(iSizeChar * 2 + iSizeChar,1);   glVertex2f(0.25,0.25);
      glTexCoord2f(iSizeChar * 2,1);        glVertex2f(-0.25,0.25);
    glEnd;
  glPopMatrix;
 
   SwapBuffers(Form1.Canvas.Handle);
end;