Hello everyone,
Intro
I'm learning OpenGL with Rust so I've got a question rather about OpenGL than Rust. I'm not sure if the forum is the right place to ask for some help about graphics programming but I have no idea where I can ask for it as my code is a piece of Rust code. If you know where I can ask such question please tell me.
Subject
I'm trying to implement an application which accepts a bunch of points and draws a plot. I want to add an ability to select some range of a plot and zoom it. Algorithm is:
1. Put data for 2 vertices (-1, 1, 0) and (-1, -1, 0) into array buffer for dynamic drawing.
2. Load shader which in fact just a white pixel.
loop:
3. Catch mouse position.
4. Update the coordinates of the vertieces.
5. Bind the vertex array of the vertieces.
6. Draw arrays in LINES mode.
7. Unbind.
The problem is that the line doesn't stick to the cursor. It is drawn with some delay. For example if I select files in my file explorer I don't see such delay of a selection rectangle so it sticks right to the cursor. So here I don't understand what slows down my application.
Sample
Code is here. I removed everything leaving only loading shaders, drawing the line and catching input events. I did my best to make the example as small as possible, but a "hello world" with OpenGL requires quite a big piece of code (200 lines in the case). I separated loading of shaders trying to prevent some distraction. I took crates gl
and glfw
.