I tried to render objects with the Vertex buffer object and it works but the problem is when I use glBegin() and glEnd to draw a line, the line doens’t show out. I am using c# and Tao as my opengl wrapper. The code snippet is as follow:
internal virtual void BindVertexBuffer(int verterCount, int[] m_nVBOVertices, double[] m_pVertices)
{
// generate the buffer
Gl.glGenBuffersARB(1, m_nVBOVertices);
Console.WriteLine("VBO" + m_nVBOVertices[0].ToString());
Gl.glBindBufferARB(Gl.GL_ARRAY_BUFFER_ARB, m_nVBOVertices[0]);
// initialize this buffer. we dont have data yet tho
Gl.glBufferDataARB(Gl.GL_ARRAY_BUFFER_ARB, (IntPtr)(verterCount * 3 * sizeof(double)), m_pVertices, Gl.GL_STATIC_DRAW_ARB);
}
public void Draw()
{
Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
Gl.glBindBufferARB(Gl.GL_ARRAY_BUFFER_ARB, mesh.m_nVBOVertices[0]); //vPosition
Gl.glVertexPointer(3, Gl.GL_DOUBLE, 0, (IntPtr)0);
Gl.glDrawArrays(Gl.GL_QUADS, 0, mesh.bilVertex);
Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
}
Any help will be appreciated. Thanks !