2010-02-17 6 views
1

Je me demande comment un tableau de 32x32 est mappé à un bitmap. Les tableaux suivants représentent un bitmap. Je sais que chaque ligne du tableau représente la ligne du bitmap. La première ligne du tableau est la dernière ligne du bitmap, et ainsi de suite, jusqu'à la dernière ligne du tableau qui est la première ligne du bitmap, mais comment cela fonctionne?OpenGL polygon stipple

GLubyte myInitial[] = { 
    0xff, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 
    0xff, 0x01, 0xff, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 
    0xff, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}; 

Répondre

2

Ce motif pointillé n'est pas très bien formaté. Il devrait ressembler à ceci:

0xff, 0x01, 0x00, 0x01, // #########    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0x00, 0x01, 0x00, 0x01, //   #    #  
0xff, 0x01, 0xff, 0x01, // #########  #########  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0x00, 0x01, 0x01, 0x01, //   #  #  #  
0xff, 0x00, 0xFF, 0x01, // ########   ########  
0x00, 0x00, 0x00, 0x00, // 
0x00, 0x00, 0x00, 0x00, // 
0x00, 0x00, 0x00, 0x00 // 

C'est un 1-bit 32x32 par pixel bitmap. Comme vous pouvez le voir, si vous dessinez un écran quad 32x32 pixels en blanc sur un fond noir, cela affichera PE.

1

Chaque octet d'entrée est constitué de 8 bits. Tout en rendant le motif est carrelé sur la surface du triangle. Partout où le motif a un bit, le pixel sera dessiné. Voir le documentation, ainsi qu'un example.

+0

Surface triangulaire? –

+0

@Charles, La forme ou l'angle de vue de la surface n'a pas d'importance. Le pointillé est appliqué au niveau du pixel. –

+0

@Mike: Bien sûr, mais la forme au décodage doit correspondre à la forme lors de l'encodage. –