I am writing graphical 2d editor and i am using OpenTK as rendering engine.
I wandering how could it possible to move and scroll the camera with the mouse to look like it is done in Photoshop.
Here is the code i have for now.
GL.Enable(EnableCap.Texture2D);
GL.Enable(EnableCap.Blend);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
...
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Viewport(0, 0, 1024, 768);
...
///Part od drawing function
ClassNodeField nField = NodeFieldsManager.GetByID(ID);
int Rows = 4000 / 128 + 1;
int Columns = 4000 / 128 + 1;
GL.ClearColor(Color.Silver);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.Color3(200f, 200f, 200f);
GL.Begin(BeginMode.Lines);
for (int i = 0; i < Rows; i++)
{
GL.Vertex3(4000, 128 * i, 0);
GL.Vertex3(4000, 128 * i, 0);
}
for (int i = 0; i < Columns; i++)
{
GL.Vertex3(128 * i, 4000, 0);
GL.Vertex3(128 * i, 4000, 0);
}
GL.End();
/// end part of drawing function
it is working fine a have the field 4000 by 4000 pixels for tests. I am planing to use 45000 by 45000. And now i need to navigate across this field and scroling with mouse wheel.
Help me with that what should i call from OpenTK to move my camera and scroll it.