Hi everybody
I have a weird problem: Simply put, I want to draw lots of horizontal lines on the screen which move vertically by time. For now, I’ve just used a simple value for Y (instead of real time) to examine the problem. There are thousands of vertices in my VBO with specific X and Y. I use glMapBuffer to access them one by one before each render loop and reduce their Y value by a certain offset. The problem is, the overall lines movement is not smooth and - on every frame - some line move up while others don’t. I’ve tried VSync, BufferData, FPS increase/decrease, etc. Here’s a sample code (C# OpenTK):
GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo);
IntPtr bufferPointer = GL.MapBuffer(BufferTarget.ArrayBuffer, BufferAccess.ReadWrite);
try
{
unsafe
{
var dataPointer = (Vector2*)bufferPointer.ToPointer();
for (int i = 0; i < _initialVertexData.Length; i++)
{
dataPointer[i].Y -= 10f;
}
}
}
catch
{
throw new Exception("Error in MapBuffer");
}
GL.UnmapBuffer(BufferTarget.ArrayBuffer);
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);