Texture with vbo some problems

Hello everybody,

I have a problem with vbo, all work.

Except textures:

Only in some places, the texture is not correct.
This is all the same places so it’s not a problem of memory.

I am a screen of the same character with and without vbo.

Here, I give you my code as:

if (vbo.ContainsKey(mesh.material))
            {
                // Utilisation des données des buffers
                Gl.glBindBuffer(Gl.GL_ARRAY_BUFFER, vbo[mesh.material][0]);
                Gl.glVertexPointer(3, Gl.GL_FLOAT, 32, new IntPtr(0));
                Gl.glTexCoordPointer(2, Gl.GL_FLOAT, 32, new IntPtr(12));
                Gl.glNormalPointer(Gl.GL_FLOAT, 32, new IntPtr(20));
                                  

                Gl.glBindBuffer(Gl.GL_ELEMENT_ARRAY_BUFFER, vbo[mesh.material][1]);

                // Activation d'utilisation des tableaux
                Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
                Gl.glEnableClientState(Gl.GL_NORMAL_ARRAY);
                Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);

                // Rendu de notre géométrie
                Gl.glDrawElements(Gl.GL_TRIANGLES, mesh.IndexArray.Length, Gl.GL_UNSIGNED_INT, new IntPtr(0));

                Gl.glDisableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
                Gl.glDisableClientState(Gl.GL_NORMAL_ARRAY);
                Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
            }
            else
            {
                uint[] tableau = new uint[2];
                // Génération des buffers
                Gl.glGenBuffers(2, tableau);

                // Buffer d'informations de vertex
                Gl.glBindBuffer(Gl.GL_ARRAY_BUFFER, tableau[0]);
                Gl.glBufferData(Gl.GL_ARRAY_BUFFER,new IntPtr(mesh.FloatArray.Length*4), mesh.FloatArray, Gl.GL_STATIC_DRAW);

                // Buffer d'indices
                Gl.glBindBuffer(Gl.GL_ELEMENT_ARRAY_BUFFER, tableau[1]);
                Gl.glBufferData(Gl.GL_ELEMENT_ARRAY_BUFFER, new IntPtr(mesh.IndexArray.Length*4), mesh.IndexArray, Gl.GL_STATIC_DRAW);

                vbo.Add(mesh.material, tableau);
                // Utilisation des données des buffers
                
            }

Thank you and goodbye,

Anyone could help me ?

I cant say for sure since I havent had a detailed look at your code, but I would say that your pointers are messed up. Take another look at those. I have had quite a few headaches with those before.

What pointers ?

Because if you speak about my board, I already checked the content is good.

And I don’t understand why some places are well positioned
and other aren’t well positioned.

Do you have another proposition ?

Im not talking about your content. In order to draw your content, you pass a pointer to your content to the GPU via something like Gl.glVertexPointer etc. In general, these kind of bugs are indicative of a pointer pointing to the wrong place. Even being off by a byte can be a pain in the rear to debug because it may just look ‘almost’ ok, except for a few places.

Ok and how can I fix this problem ?

Surprising because the textures are always drawn in the same place, even for textures misplaced.

:frowning:

Pourriez vous me dire, quelles choses sont meme differentes (sauf VBO). Parce que votre code est regardee tout a fait raison. Peut etre, quelque autre shader quand VBO est active, ou autre chose.
Et ces bizzares couleurs, est ce qu’ils presentent dans la texture?

Nice try Jackis, your post mostly makes sense :slight_smile:

Well, I tried to help Pierre, but he has suddenly disappeared… May be, has been frightened of my french? :slight_smile:
And yes, I liked that panda… Didn’t you like it? :wink: