I'm having some issues using VBOs to display a changing image. I'm writing a program that will read data from a location, convert that data to a color value and then display the resulting value on the screen as the data is being collected. So basically I'm creating a 2d height map with OpenGL as I read the data (I then render this to 3d with an offline program). The problem is that when I use VBOs the viewport doesn't seem to update. I fill an array with every 2d vertex in the viewport (0,0,0,1,0,2,...j,0,j,1,...j,k) and hook that to the vertex array, and I create another array into which I put my color data which is dynamically updated and hook that to the color array.
Now when I do this without using VBOs it works just fine, I see my image being built in real time. In my data acquisition loop I raise an event after each line of data is collected and put into my color data array that is handled by this function:
Private Sub updateviewport() GL.ColorPointer(4, ColorPointerType.Double, 0, colorArray) GlControl1.Invalidate() End Sub
colorArray is where I store my color data.
When I do the equivalent thing with VBOs, the viewport remains remains black.
GL.BindBuffer(BufferTarget.ArrayBuffer, buffer(1)) GL.BufferData(BufferTarget.ArrayBuffer, IntPtr.Zero, IntPtr.Zero, BufferUsageHint.StreamDraw) GL.BufferData(BufferTarget.ArrayBuffer, colorArray.Length * 8, colorArray, BufferUsageHint.StreamDraw) GL.ColorPointer(4, ColorPointerType.Double, 0, IntPtr.Zero) GlControl1.Invalidate()
buffer is my unsigned integer array where I keep vertex and color data. Using the BufferSubData() function doesn't work either. While debugging, I found that when Invalidate() is called when using VBOs, the Paint subroutine isn't called and I don't understand why.
Also, I tried just filling the entire buffer beforehand with my color data and then rendering at the very end that worked just fine. But I want to be able to show the image being constructed as data is collected. I've resigned to not using VBOs for now so I can continue on my project but it seems that everyone suggests VBOs as the best way to use OpenGL. Any suggestions? Thanks.