Bonsoir à tous

je me heurte à un problème et je ne trouve pas de ressource pour le résoudre,ce #@! de code

En ait je cherche à utiliser les tableaux pour balancer mes points à dessiner : aucun problème pour afficher les vertices, par contre pour la texture, je sais pas du tout comment je dois faire

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
 
  static void drawFloor(GL myGL , Texture2D texture, float scale ) {
        float vertices[]    = new float[] { 0,0 , 35,0 , 35,30 , 0,30 , 0,30 , 35,30 , 20,40 , 
                                            0,40 , 0,40 , 135,40 , 135,66 , 0,66 ,
                                            0,66 , 35,66 , 35,99 , 0,99 , 0,99 , 35,99 , 20,110 , 0,110,
                                            0,110 , 178,110 , 178,129 , 0,129 , 36,129 , 178,129 , 178,139 , 36,139,
                                            36,139 , 56,139 , 56,155 , 36,155 , 36,155 , 142,155 , 142,161 , 36,161,
                                            0,161 , 142,161 , 142,183 , 0,183 };
 
        FloatBuffer tmp = BufferUtil.newFloatBuffer( vertices.length );
        for( int i = 0 ; i < vertices.length; i++ ) tmp.put( ( vertices[i] * scale ) );
        tmp.rewind();
        myGL.glEnableClientState( GL.GL_VERTEX_ARRAY );
        myGL.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY );
        // Les coordonnées vont 2 par 2
        myGL.glVertexPointer( 2 , GL.GL_FLOAT , 0 , tmp );
        myGL.glTexCoordPointer( 2 , GL.GL_FLOAT , 0 , tmp );
 
        int SIZE_FLOAT      = 4;
 
        int indices[] = new int[ vertices.length];
        for(int i = 0 ; i < vertices.length ; i++ ) indices[i] = i;//{ 0,1,2,3,4,5,6 };
        IntBuffer indicesBuf = BufferUtil.newIntBuffer( indices.length);
        indicesBuf.put( indices );
        indicesBuf.rewind();
 
        texture.bind();
        myGL.glColor3f(0.86f,0.53f,0.43f);
        myGL.glDisable( GL.GL_CULL_FACE );
        myGL.glPushMatrix();
            myGL.glTranslatef( 0 , 12.5f * scale , 0 );
            myGL.glRotatef( -90,1,0,0);
 
            myGL.glDrawElements(GL.GL_QUADS, vertices.length,GL.GL_UNSIGNED_INT, indicesBuf);
 
        myGL.glPopMatrix();
        myGL.glEnable( GL.GL_CULL_FACE );
    }
merci