VBO

Dec 26, 2014 at 5:53 PM
Edited Dec 26, 2014 at 5:58 PM
In past few days i am traing to display a mesh with VBO. Unfortunatly without any success...
If someone can point me in any direction what i am doing wrong i will be very thankful .
private void DrawMesh_New()
        {
            SharpGL.OpenGL gl = this.openGLControl1.OpenGL;
            gl.ClearColor(0.39f, 0.53f, 0.92f, 1);
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.LoadIdentity();
            gl.LookAt(50, 50, 50, 0, 0.5f, 0, 0, 1, 0);
            gl.Rotate(0, rotation++, rotation / 2);

            gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY);
            gl.EnableClientState(OpenGL.GL_NORMAL_ARRAY);
            unsafe
            {
                fixed (float* verts = vertices)
                {
                     var ptr = new IntPtr(verts);
                     gl.VertexPointer(3, OpenGL.GL_FLOAT, 3 * sizeof(float), ptr);
                }
            }
            unsafe
            {
                fixed (float* norms = normals)
                {
                    var pNormals = new IntPtr(norms);
                    gl.NormalPointer(OpenGL.GL_FLOAT, sizeof(float) * 2, pNormals);
                }
            }

            for (int i = 0; i < m_Model.Surfices.Count; i++)
            {
                unsafe
                {
                    uint[] surfice_indices = new uint[m_Model.Surfices[i].triangle_count * 3];
                    Array.Copy(indices, m_Model.Surfices[i].index_offset, surfice_indices, 0, surfice_indices.Length);
                    //gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY);
                    //gl.EnableVertexAttribArray(0);
                    //gl.VertexAttribPointer(0, 3, OpenGL.GL_FLOAT, false, 0, new IntPtr(0));
                    fixed (uint* s = surfice_indices)
                    {
                         var ptr = new IntPtr(s);
                         gl.DrawElements(OpenGL.GL_TRIANGLES, surfice_indices.Length, OpenGL.GL_INT, ptr);                        
                    }
                }
            }
        }
Just nothing drawed.
and in same moment if i build an GL_ARRAY_BUFFER everything is working just fine.
Jan 13, 2015 at 11:12 AM
Hi,

probably you ran into the same problem as I did:

https://sharpgl.codeplex.com/discussions/567675

Depending on the OpenGL version you are using the methods LoadIdentity, Lookat and Rotate are deprecated.
You can find out here which methods are deprecated:
https://www.opengl.org/sdk/docs/

Cheers

Thomas